The VBA Code Can't run in shared folder (LAN Network) (1 Viewer)

nadim98

New member
Local time
Today, 09:49
Joined
Feb 1, 2024
Messages
3
The VBA code is not running at all when I add my database system to the shared folder. It's a LAN Network (in This PC -> Network locations)
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:49
Joined
May 7, 2009
Messages
19,243
did you split it? put the Back end to the shared folder
and the Front end to your workstation.
 

nadim98

New member
Local time
Today, 09:49
Joined
Feb 1, 2024
Messages
3
How ?
 

nadim98

New member
Local time
Today, 09:49
Joined
Feb 1, 2024
Messages
3
because additional users wish to contribute data to the database
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 03:49
Joined
Feb 28, 2001
Messages
27,186
"Code not running"? OK, how do you KNOW it isn't running? (We are looking for specific symptoms.) Do you get a warning about code being disabled? Does it simply fail to take breakpoints?

At first glance, I might wonder if you are running afoul of the "trusted locations" rule that Windows often enforces regarding where code can be executed. But if that IS the case and you are talking about sharing the DB among multiple users, another issue is splitting the database.

In a "stand-alone" database used by one person, you don't really care that everything is in a single file. You use it where you built it and nobody knows any different. HOWEVER, the moment you start sharing, you run into a multitude of issues having to do with file locking and with data usage interference. This is when you need to "split" the database into two parts.

There is a facility in the Database Tools ribbon to split databases into a "Front End" (FE) and a "Back End" (BE). The FE contains everything EXCEPT the data. The BE contains ONLY the data. Then you put the BE in the shared area. You then make a "master copy" of the FE in which you update the linked table references to the shared BE file. You distribute private copies of the FE to your users. They can run the code locally from their desktop or other convenient place and there IS no code in the BE to run into the "trusted locations" rule.

This is important because of Windows File Locking, which occurs whether you want it to or not. If you share a "monolithic" (i.e. unsplit) DB, everyone locks the file and the odds are extremely high that if your users are all doing pretty much the same thing, they will step on each other and will eventually lock something to cause the app to fail. When it does, there is a serious chance that it will become corrupted and unusable. If you have the FE copied to each user, they are running private copies of the FE so no one else is locking the same file and there will be no lock collisions.

Please note that there is a lot more to it than what I just described. The topic of "splitting databases" is worthy of a Search in this forum and you will find tons of articles on the subject. Take a look at the "Similar Threads" list which contains a sampling of discussions on FE/BE splits.
 

gregbowers

New member
Local time
Today, 14:19
Joined
Jan 23, 2024
Messages
7
The VBA code is not running at all when I add my database system to the shared folder. It's a LAN Network (in This PC -> Network locations)
Hello

Troubleshoot VBA code not running after moving to a shared folder:
  1. Check Permissions:
    • Ensure proper read and execute permissions for VBA code and files.
  2. Macro Security:
    • Enable macros and adjust security settings in Excel.
  3. Trusted Locations:
    • Add shared folder to trusted locations in Excel Options.
  4. Drive Mappings:
    • Use consistent UNC paths to avoid drive mapping issues.
  5. Linked Tables:
    • Update database linked tables to new folder paths.
  6. Consider Network Latency:
    • Account for delays in accessing shared resources.
  7. Implement Error Handling:
    • Add error handling in VBA code to identify issues.
  8. Firewall and Antivirus:
    • Temporarily disable to check for interference.
  9. Verify VBA References:
    • Confirm external references are accessible.
  10. Check Event Logs:
  • Examine event logs for relevant error messages.
 

Users who are viewing this thread

Top Bottom