Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Macros Work. VBA Does Not.
Mark Fannin 
      
16 months ago
I successfully split my database.  As I tested functionality I discovered that macros for form functions (open form, close form) work BUT those forms I replaced macros with SQL docmds (open form, open form to new record, close form) do NOT work.  No errors, but the button actions with SQL functions won't work.  Any ideas?  As usual, many thanks in advance.
Alex Hedley  @Reply  
           
16 months ago
John Davy  @Reply  
         
16 months ago
Hi Mark
Please show us the code  John
Mark Fannin OP  @Reply  
      
16 months ago
Hi and thanks for taking time to help.  I have the database in a trusted location.  Attached is a sample of the macro (that works) and the very simple SQL that doesn't.
Mark Fannin OP  @Reply  
      
16 months ago

Mark Fannin OP  @Reply  
      
16 months ago

Kevin Robertson  @Reply  
          
16 months ago
Check the Events tab in the Property Sheet. Does it say Event Procedure for the Click event of the Button.
If it doesn't you will need to reattach your code. Click on the builder button (...).
Alex Hedley  @Reply  
           
16 months ago
Name your buttons too :p
Kevin Robertson  @Reply  
          
16 months ago
Actually wondering if the button was possibly renamed after the code was entered.
Mark Fannin OP  @Reply  
      
16 months ago
Thanks for the advice.  I've "re-split" the database from copies.  Before splitting the database works great in the trusted location.  No issues.  After the split is when the SQL quits working but the macros all function.  Which bugs me because I much prefer SQL and wanted to get rid of all the macros in favor of SQL code.  Always something I guess.  I will try it on another computer....  Thank you.
Mark Fannin OP  @Reply  
      
16 months ago

Mark Fannin OP  @Reply  
      
16 months ago
Got it working.  Not sure why but this was the issue....   I had made a trusted location on an external drive, and it worked fine until I performed the split database location on it.  I then decided to use a trusted location on my C: drive.  It works great!  No issues whatsoever.  I guess something about the external hard drive that caused the problem.  Thanks to everyone who gave advice.  All the best.
Bill Carver  @Reply  
      
16 months ago
What kind of drive or location was the split file kept?
Mark Fannin OP  @Reply  
      
16 months ago
External HDD plugged into a USB port.  Location was a trusted subdirectory.  All three files were there - the orginal db, then the backend and front end, all in the same subdirectory.
Mark Fannin OP  @Reply  
      
16 months ago
The adventure continues, sadly.  I've narrowed the issue down to this - after the database is split the command buttons with macros work - but the command buttons with VBA code (docmd, open form, etc) do not funtion.  No errors, nothing.  I've split multiple databases by experimenting with changing pre-split command buttons with macros, to VBA code and they quit working.  I then restored the macro to the same command buttons and they started working.  Before the database is split, both macros and VBA code works fine.  After the split, the front-end command buttons with VBA quit working.  If someone wants to take a deep dive there will be a reward for finding the offending cause.  I apologize for multiple posts but I don't have anywhere else to turn for advice.  All the best.
Matt Hall  @Reply  
          
16 months ago
Did you intend to post the property sheet for a Form or a Button?
Mark Fannin OP  @Reply  
      
16 months ago

Mark Fannin OP  @Reply  
      
16 months ago

Mark Fannin OP  @Reply  
      
16 months ago

Mark Fannin OP  @Reply  
      
16 months ago

Richard Rost  @Reply  
           
16 months ago
Access will treat external drives as network locations. Make sure you allow that in your trust settings.
Mark Fannin OP  @Reply  
      
16 months ago
Thanks.  I've moved everything to the trusted folder on the C: drive.   VBA events are not firing and when I replace them with macros they work great.  It's so weird.  Thanks again.
Richard Rost  @Reply  
           
16 months ago
So strange. Can you MsgBox? Something simple?
Richard Rost  @Reply  
           
16 months ago
Do other databases work? Run down the Troubleshooter for shits and giggles. It might just be something stupid none of us thought of. Office Update? Reboot?
Mark Fannin OP  @Reply  
      
16 months ago
I created a new database.  I put in both macros and VBA event procedures to open test forms.  I split the database and the front end works with both macros and VBA events perfectly.  So there is something goofy in my other database.  I don't think I can solve it as it would require an autopsy by microsoft engineers.  Too bad, I have hundreds of hours in that one.  I won't bother anyone further with this goose chase.  Thank you all for your advice and interest.
Mark Fannin OP  @Reply  
      
16 months ago
Richard:  To answer your question, no VBA works - no msgbox, no VBA sorting, no requery, nothing.
Richard Rost  @Reply  
           
16 months ago
Well, at least we figured out that something's corrupted in that database. You might want to try a compact and repair, or even a decompile. If all else fails, just create a new database file and then import all the objects from the old one into the new one.
Mark Fannin OP  @Reply  
      
16 months ago
Thanks to everyone for the help and interest.  I will take all the advice AND name all my buttons from here on out :)

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

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 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 10:20:00 PM. PLT: 1s