Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > Backup Record < ZIP Code Lookup | Replace >
Back to Backup Record Before Edited    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
OnDirty
Sara Kost 
    
13 months ago
I followed the steps outlined to On Dirty run a backup query to save records to a backup table. I followed the same steps with identical code structure for multiple forms/tables. In every one of my forms it works perfectly, except one. When I try and edit that particular form I get the error "The expression On Dirty you entered as the event property setting produced the following error: Return without GoSub". If I open my form properties, click On Dirty [Event Procedure] so that VBA opens, close it (without changing anything), and hit save on my form it then works, until I restart Access. Can you please help with what is happening to this particular form?

Here is my code for the event procedure:
Private Sub Form_Dirty(Cancel As Integer)
    DoCmd.SetWarnings False
    DoCmd.OpenQuery "LocBackupQ"
    DoCmd.SetWarnings True

End Sub

Here is the SQL for the backup query:
INSERT INTO BULocT
SELECT LocT.*
FROM LocT
WHERE (((LocT.LinkerLoc)=[Forms]![3ALocF]![LinkerLoc]));
Kevin Robertson  @Reply  
          
13 months ago
It seems like the issue may stem from a corruption or misconfiguration in the event property for that specific form. The error "Return without GoSub" generally indicates that there's a mismatch or missing link in the event procedure setup, even though the code itself looks fine.

Here are a few things you can try to resolve the issue:

Recreate the Event Handler:
    Delete the [Event Procedure] in the On Dirty event.
    Save and close the form.
    Reopen the form, and reassign the event procedure in the On Dirty event.
    Manually copy and paste the VBA code back in and save the form again.

Check for Other Event Triggers:
    Ensure that there are no other event procedures or macros (like Form_Open or Form_Load)
    that might be interfering with the On Dirty event on this particular form.

Check References:
    Go to Tools > References in the VBA editor and check if any of the references are marked
    as "MISSING." If so, try fixing those by unchecking or updating them.

Form Corruption:
    If none of the above work, the form might be slightly corrupted. You can try creating a new blank form,
    then copying all controls and VBA code from the problematic form into the new form. Assign the events
    again and see if the issue persists.

I also notice you have a Form name which starts with a number (3ALocF). This could also be causing problems.
As a rule all object names and field names should start with a letter.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Backup Record Before Edited.
 

Next Unseen

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2025 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 11/14/2025 1:10:28 AM. PLT: 1s