"Return without GoSub" when using subforms in Access
Asked Answered
W

5

16

Why do I get a

"Return without GoSub"

error when using subforms in Access 2007?

Welladvised answered 13/7, 2012 at 9:29 Comment(0)
W
25

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.

Welladvised answered 13/7, 2012 at 9:29 Comment(6)
There is no problem with having form load events in both the form and the subform, there is a problem with having subform load events that refer to the main form because the subform loads before the main form.Dedicate
Genius, I removed the Form_Load() event and it worked like a charm :)Kraal
Adding an empty Form_Load() solved the problem for me - what a strange issueAlvaalvan
@Alvaalvan I think Fionnuala is write about the root of the problem, though. There's probably a bigger issue that also needs addressing.Welladvised
There was indeed haha - it made itself apparent about an hour after I posted this. Long story short, it involved my lack of understanding with INNER/LEFT/RIGHT joins but I was able to fixAlvaalvan
Wow. That fixed it for me too... for no good reason whatsoever. I didn't have Load() defined for either the master or subform, but defining both made the problem go away.Attainture
D
7

The most likely reason for this error is that the project has become corrupt. You should decompile, instructions are here: Debug a bad DLL calling convention error

First, ensure that you have switched off Name Autocorrect: http://allenbrowne.com/bug-03.html and ensure that you are not missing any references.

Dedicate answered 13/7, 2012 at 10:4 Comment(0)
M
0

I found a useful solution (in my case) for that same issue at http://www.fmsinc.com/microsoftaccess/performance/decompile.asp . It worked as a charm for me. HTH Phil

Marcenemarcescent answered 20/12, 2013 at 19:4 Comment(2)
If possible, it's best to include a description of the answer, in case the link goes dead one day...Riproaring
This is copied from the link above: To decompile your database, follow these steps From the Windows, Start, Run command line, type: msaccess.exe /decompile where msaccess.exe includes the complete path. For example, for Access 2016: C:\Program Files\Microsoft Office\Office16\MSACCESS.EXE /decompile From Access open the database you want to decompile (with trusted authority for Access 2003 or later) Open up any module. Compile it via Debug, Compile, then File, Save. Go back to the database and Compact it. The database size should be reduced and errors related to the VBA code gone.Syncopation
L
0

Performing a decompile of the VBA code and recompiling followed by compacting my database resolved the issue for me.

Lauds answered 10/4, 2015 at 14:55 Comment(2)
Can you provide more details?Libretto
Also, how is this different to Fionnuala's answer above?Welladvised
M
0

I had something similar (not specifically in VBA, but with using a form to update a subform). I just added a "StopAllMacros" step at the end of the screen updating object and it seemed to work.

enter image description here

Midsection answered 31/5, 2019 at 15:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.