What does this macro error mean?

G

gagecres

I just made a change to my database and now I am getting an error message
when I open it. The message says: "The expression OnCurrent you entered as
the event property setting produced the following error: Return without
GoSub."

What does this message mean?
 
J

Jeff Boyce

If you're not sure what you changed, how are you planning to un-do the
change?

The error message suggests that you have a form that has an OnCurrent event.
Can you find that one?

The message also suggests that the code in that OnCurrent event has a
<Return> statement, but nothing that called it in the first place. Can you
find that?

If you can find the OnCurrent event that's throwing the error, consider
posting the SQL statement for that event. That would give folks a bit more
to go on...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
D

Dorian

I'm guessing that some VB code you have in the Current event, has invalid
code in it.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
L

Linq Adams via AccessMonster.com

As Jeff has suggested you need to look at the Form_Current event in the VBA
code window. This type of error, despite the message

"Return without GoSub"

often comes from one sub being copied and pasted within another sub, ending
up with something like this:

Private Sub Form_Current()

Private Sub CommandButton_Click()
'Do something
End Sub

MyTextBox.SetFocus

End Sub

so that you have two sub headers before you have an End Sub statement. I've
seen this type of mistake trigger this very error message, which is confusing,
of course, because it's inaccurate.
 
J

John_G via AccessMonster.com

Did you compile your code after you made the changes? Compiling will usually
catch that type of error.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top