Results 1 to 3 of 3
  1. #1
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694

    Using variables to trap write conflicts

    Could someone help me on the use of public vars to restrict the use of procedures when multiple users have a db open?



    What I'm thinking about doing is creating a public var for each procedure that is relevant to the form from which it is called. I'm wondering if this would create unnecessary memory usage. For example, the variables would be -
    Code:
    PUBLIC VAR MODULE
    
    public Proc1Run as boolean
    public Proc2Run as boolean
    And, toggle them at the beginning and end of procedures. E.G. -
    Code:
    sub proc1
    
    'UNIVERSAL CODE BEHIND ALL PROC'S
    if Proc1Run=true then
         msgbox "Another user is updating this data.  Try again later"
              exit sub
    else
    
         Proc1Run=true
    
    'REST OF THE CODE HERE
    
    end if
    
         Proc1Run=false
    
    end sub
    Are there any roadblocks to this approach? The other thing I'm wary of is if additional memory is going to be allocated to the public vars EACH time the db is opened in the front end. E.G. - 1 var * 5 users = 5x the memory needed for 1 var is now allocated. The other thing I'm concerned about too, is the db becoming corrupt when a write procedure gets interrupted by another user.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    The roadblock is that a multi-user application should be split, with each user having their own copy of the front end. In that scenario, the variables in one front end would not be visible to another. To do the sort of thing you're contemplating and maintain "proper" design, you'd need to keep the value in the back end. The db will almost certainly corrupt with multiple simultaneous users.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by pbaldy View Post
    The roadblock is that a multi-user application should be split, with each user having their own copy of the front end. In that scenario, the variables in one front end would not be visible to another. To do the sort of thing you're contemplating and maintain "proper" design, you'd need to keep the value in the back end. The db will almost certainly corrupt with multiple simultaneous users.
    that makes sense paul. thanks. I think I'll just stick with record locks.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Shell with Batch Variables
    By robbyaube in forum Programming
    Replies: 2
    Last Post: 12-19-2019, 11:06 AM
  2. Variables in Forms
    By NewDeveloper in forum Forms
    Replies: 1
    Last Post: 06-20-2010, 08:04 AM
  3. Append Query using variables
    By hawg1 in forum Queries
    Replies: 2
    Last Post: 06-09-2010, 08:59 AM
  4. Eval function with variables
    By tuna in forum Programming
    Replies: 3
    Last Post: 05-14-2010, 06:02 PM
  5. sql in vb variables
    By emilylu3 in forum Programming
    Replies: 3
    Last Post: 03-04-2006, 01:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums