On Current Error Message (1 Viewer)

Tophan

Registered User.
Local time
Today, 11:48
Joined
Mar 27, 2011
Messages
367
Good Morning,

I changed an existing form to a tabbed form so I could add a second subform. This is causing an error when I first open the form which says "The expression On Current you entered as the event property setting produced the following error: Return without GoSub".

The only On Current event is the following on the main form
Code:
Private Sub Form_Current()
Me.frmTaskSheetDtls.Form.cboJobName.Requery
End Sub

frmTaskSheetDtls is the original subform

The form is still working but it's just this message when I first open the form. If I close and reopen the form without closing the database the message does not appear.
 

Mike Krailo

Well-known member
Local time
Today, 11:48
Joined
Mar 28, 2020
Messages
1,043
I googled this and found the following.
This can occur when there is a Form_Load() event in the subform, but not the main form. Try adding an empty Form_Load() event to the main form.
 

isladogs

MVP / VIP
Local time
Today, 16:48
Joined
Jan 14, 2017
Messages
18,211
This can occur when there is a Form_Load() event in the subform, but not the main form. Try adding an empty Form_Load() event to the main form.
Recent versions of Access will remove any empty procedures.
To ensure that doesn't happen in this case, add a comment line e.g.

Code:
Private Sub Form_Load()
'this is a dummy procedure as a test
End Sub

For info, empty procedures are now automatically deleted because such procedures used to prevent compiling of ACCDB files to ACCDE
 

Tophan

Registered User.
Local time
Today, 11:48
Joined
Mar 27, 2011
Messages
367
I already have an event in the On Load on my main form :(
 

Tophan

Registered User.
Local time
Today, 11:48
Joined
Mar 27, 2011
Messages
367
I really wish I could but unfortunately I can't upload the database as it has been in use for 3 years and has some sensitive info in it.
 

Tophan

Registered User.
Local time
Today, 11:48
Joined
Mar 27, 2011
Messages
367
Success. I did the following on the Before Update event and it worked!
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
this is a dummy procedure as a test
End Sub

As always...thanks for everyones help :)
 

isladogs

MVP / VIP
Local time
Today, 16:48
Joined
Jan 14, 2017
Messages
18,211
Congratulations. Hopefully you remembered the comment quote mark at the start of the line
Somewhat surprised that using that event worked....:giggle:
 

Tophan

Registered User.
Local time
Today, 11:48
Joined
Mar 27, 2011
Messages
367
Yes...I had to go back and add the apostrophe. Don't know why it worked either but it did 🤷‍♀️
 

Users who are viewing this thread

Top Bottom