From: Dinamo/Pistons on
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
From: Daryl S on
Dinamo/Pistons -

I would search (Find) your whole project for any 'Return' statements.

I would also compact/repair your database and re-compile it.

It may not be in the Open method of the form you are looking at, so look
everywhere.

--
Daryl S


"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
From: mie via AccessMonster.com on
Try recompile your code. Select All, Cut and Paste, Debug>Compile Database.

or maybe some of your procedure missing "Exit Sub".

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/Forums.aspx/access-forms/201005/1

From: BruceM via AccessMonster.com on
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/Forums.aspx/access-forms/201005/1