A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Form Open Error Message



 
 
Thread Tools Display Modes
  #1  
Old May 20th, 2010, 06:50 PM posted to microsoft.public.access.forms
Dinamo/Pistons[_2_]
external usenet poster
 
Posts: 8
Default Form Open Error Message

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
Ads
  #2  
Old May 20th, 2010, 08:38 PM posted to microsoft.public.access.forms
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Form Open Error Message

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

  #3  
Old May 21st, 2010, 08:41 AM posted to microsoft.public.access.forms
mie via AccessMonster.com
external usenet poster
 
Posts: 9
Default Form Open Error Message

Try recompile your code. Select All, Cut and Paste, DebugCompile 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/For...forms/201005/1

  #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

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:19 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright 2004-2018 OfficeFrustration.
The comments are property of their posters.