View Single Post
  #4  
Old May 21st, 2010, 12:19 PM posted to microsoft.public.access.forms
BruceM via AccessMonster.com
external usenet poster
 
Posts: 448
Default Form Open Error Message

For one thing, the Open event is too soon to work with the recordset, as it
has not yet been loaded. The Load event would be the place for DoCmd.
GoToRecord , , acNewRec (or Me.Recordset.AddNew). Other than that, try
adding Option Explicit below Option Compare Database for each code module,
then compile the code. To turn on that option (as you should anyhow), in the
VBA editor go to Tools Options General tab, and check Require Variable
Declaration (Access 2003 and earlier; not sure where it is in later versions).


Why disable the subform in the Load event? Why not just set it on the
Property Sheet? You can change it through code later, if you want.

What do you mean by "open and close the event procedure"? What fields did
you delete?

Dinamo/Pistons wrote:
I added three new fields to a form and now I get the following error:
The expression On Open you entered as the event property setting produced
the following error: return without GoSub

Well I did not change the On Open event procedure.. here it is:
Private Sub Form_Open(Cancel As Integer)
DoCmd.GoToRecord , , acNewRec
Me.subFormRepeatCalls.Enabled = False
End Sub

Interesting enough after I open and close the event procedure, I can open
the form without problems. If I exit the database I get the same error. I
deleted the fields, but I am still getting the same error

PLEASE HELP


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201005/1