Share via

Return without GoSub

Anonymous
2012-02-10T20:39:26+00:00

I have a database that has a number of tables, queries, forms & reports. It worked fine yesterday, when I opened it today and click on any of the command buttons on the Master form I get the following error message: "The expression On Click you entered as the event property setting produced the following error: Return without GoSub."  Why did this happen?

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2012-02-10T21:23:45+00:00

Can't tell you why it happened without seeing all of your code.  But, I can tell you how you SHOULD be able to diagnose the problem. 

From the VBA Window go to DEBUG > COMPILE

and fix any errors that it highlights.  Then continue selecting it and fixing errors until you don't get any more.

Was this answer helpful?

40+ people found this answer helpful.
0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Anonymous
    2016-10-05T21:41:27+00:00

    I had this problem starting last week in a database I use to track online entries.

    Any action button would create this this error.

    If I went in to Design Mode - selected one of the buttons and then opened the code - returned to Form View - and it would work.

    If I closed the database and re-opened it the error would return.

    Then I remembered that I had deleted a Button - which I must have created - had a default name - and maybe opened a code window - but had never put in code in it.

    So I went into the code and sure enough there was cmdButton39 or something like that code section.

    Had the header and of course End Sub - but no code in between.

    So I deleted that code section and that has corrected the problem.

    I do not remember getting an error when I deleted the button.

    Was this answer helpful?

    10+ people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2016-02-17T11:04:13+00:00

    Have found that if you enter Design Mode, follow one of the Event pointers into the code, change nothing, and then just exit back to Design Mode then Form Mode - it then works properly. Has now happened several times but these steps have cleared it. This is using Access 2013.

    Was this answer helpful?

    4 people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2013-09-04T21:08:42+00:00

    I'm trying to do this too and am a really basic user.... I go into the VBA window (I think!) and under debug the compile is not accessible!

    Try typing a space somewhere in the actual code window and then try.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2013-09-04T10:25:53+00:00

    I'm trying to do this too and am a really basic user.... I go into the VBA window (I think!) and under debug the compile is not accessible!

    Was this answer helpful?

    0 comments No comments