Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error: Return without GoSub

Status
Not open for further replies.

5981

Technical User
Nov 6, 2003
10
0
0
US
I dont know what I did. When I opened my database the swithboard is not poping up and i get the error Return without GoSub. I did not do anything to the swithboard does anyone know what might be the cause?
 
Check in your code (I.e. Open Event of the Switchboard) to see if it has a keyword &quot;Return&quot; in it. If it does, look within the procedure to see if you have a Statement &quot;GoSub <Line>&quot;, and if it doesn't, then that is where your problem lies at.

To make your search easier, you can bring up the Find Dialog box within VBA Editor, and type in the word, &quot;Return&quot; (without the double quotes), and search in each of the modules or the entire project even.

Syntax of GoSub...Return

GoSub <Line>
. . .
<Line>:
. . .
Return

OR

Goto <Line2>
. . .
<Line>:
. . .
Return
<Line2>:
. . .
GoSub <Line>

Note the above syntaxes. <Line> and <Line2> are line labels within VBA. However, given now days that we can call on Subprocedures and Functions directly, the GoSub...Return bit of coding is obsolete and is not advised to use any more. Not only that, but the &quot;GoSub <Line>&quot; and &quot;Return&quot; line MUST be within the same procedure.

Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
When the going gets tough, the tough gets going.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top