Return with out GoSub

chellebell1689

Registered User.
Local time
Today, 15:55
Joined
Mar 23, 2015
Messages
267
Hello,
I have a form that I use to enter visitors and normally it works great, but today when I hit my button to enter a new visitor or to close the form, I get an error "Return without GoSub". I have googled this, but everyone else with this problem has a subform in their form, which is not my case. I've used a couple other forms today that worked great (even had to use the new record macro in another form and it worked). I'm not using code, just simple macros "GoTo Record > New" & "Close Window > Form > VisitorsForm"

I don't know what else to provide, so please let me know if you need any specific details! Thank you!!
 
my guess would be you have a null value somewhere
 
That shouldn't matter. I only have one field that is required to be filled out, and that one is. I've opened the form on the first record and it gives the same error when I click either button.

Also, I did add a test visitor to check your theory and even with every single box filled/checked I still get the error.

Thanks for the theory.
 
I did google, all the ones I found were corruptions with a subform, I don't have a subform.

**Edit** Also, a lot of the ones I read were corruption in VBA, I do use VBA on some forms, but not this form or any that have to do with this form and the records generated by it.

I will check the decompile and see if that works. I've done compact & repair on it three times since I've opened it today (not sure if that makes a difference).
 
Last edited:
macros generate vba in the same way the query window generates sql. Subform/form, makes no difference, if the code is corrupted, it's corrupted.

compact and repair will not fix corrupted code

if you are using macros and decompile does not work, delete the macros, compact and repair then recreate the macros again

The only other thing I can think of is a missing reference, however I don't use macro's so not sure if this would be relevant
 
Ok, that makes sense, thank you for explaining that!

I tried following the directions in that post, but my cmd keeps telling me the path could not be located. I've checked several times and my paths are correct. Not sure if it matters that the db I'm working on is saved on a flash drive...maybe that's why the cmd box kept giving me an error? I know I used the right path for both parts of the command he gave.

I will try your solution to delete, recompact, readd. Thanks
**Edit** I tried that and it still doesn't work -_-
 
Last edited:
It's working now. I finished the steps I could on that link you sent. By time I got done with those, the two buttons acted like they had no events set up, so I deleted them and re-added them and all works great now.

Thank you so much for your help!
 
Last edited:
Had it also several times after changing a form and was not able to find the cause. What helped for me is to open a blank database and import everything again, forms, tables etc.
Via external data, access...

Ben
 
no problem, but sounds like you do not have front end/back end setup. If you don't I strongly recommend you split your db - next time you get a corruption you may not be able to access the data.
 
I do need to split it, but I don't know how to. Also, I'm trying to wait because I'm currently using my personal laptop to work on this, and the church I'm doing this for does not have a computer that is compatible with this version of Access (they're still on XP). They are working on getting a computer updated so it can run Access 2016 (or even 2013).

Does that make a difference? Once they get the computer updated, I won't be using my laptop anymore.
 
plenty of threads on the subject of splitting. In principle either use the wizard or do the following

1. make two copies of your db - call one say mydbFE and the other mydbBE, then close your original db

2. open the mydbBE file and delete all forms, reports, queries and modules (and macros) so that only tables are left. close the file, that is your backend done

3. open the mydbFE and delete all tables, leave all forms, reports, etc as is

4. Now link to the backend using External Data>Access>Select Link and browse to your backend, then select all the tables

5. job done

The only issue is if you are moving the db around while developing you need to relink each time
 
Usually, a RETURN without GOSUB means you have jumped into the context of a subroutine (not GOSUB'ed, but GoTo) and then returned normally. With pre-generated event code, it is hard to imagine this happening EVER (because the templates that are used for event code are about as plain vanilla as possible).

If you had written some VBA code intended to be recursive, I could see something like this happening, maybe. Also, if you edited one of the event routines to declare an event handler that did not RESUME but simply returned, that might confuse Access pretty much.
 

Users who are viewing this thread

Back
Top Bottom