Results 1 to 2 of 2
  1. #1
    knarfreppep is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Feb 2015
    Location
    Adelaide, Australia
    Posts
    106

    Which front-end gets there first

    Hello everyone!



    I have a front-end/back-end application.

    I want a front-end to compact the back-end each morning.

    Obviously the front end which will do the job must stop other front-ends from proceeding.

    I figure there's some chance of two front-ends trying at exactly the same time.

    So I'm thinking I'll generate a large random number and let the front-end with say the biggest number proceed if there are two or more.

    So my question for very clever mathematicians is: what are the odds of the code below returning the same number from say 10 front-ends please? -

    Code:
    Public Function sngNumber() As Single
        
        Randomize
    
        sngNumber = 2000001 * Rnd + 1000000
    
    End Function

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    I had to read this several times before (hopefully) understanding it.
    I think you are talking about several users each running their own copy of the FE.
    If so, I suggest you scrap your randomise idea and do it differently.

    Run a scheduled task from the server to compact the BE at a time when nobody is using it e.g. 02:00.

    Or if that's no good for your situation, add a field which stores when the BE was last compacted.
    When the FE is opened, the field value is checked.
    If the date is not the current date, run the compact and reset the date. Otherwise exit that code.

    It is not a good idea to have other users login whilst compacting is being run.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. Different front ends
    By cbende2 in forum Misc
    Replies: 5
    Last Post: 06-01-2015, 12:40 PM
  2. Front End
    By rosscortb in forum SQL Server
    Replies: 3
    Last Post: 03-06-2015, 02:54 PM
  3. Front end help
    By hrenee in forum Reports
    Replies: 6
    Last Post: 10-21-2013, 11:28 AM
  4. front end changes take forever
    By survivo01 in forum Programming
    Replies: 4
    Last Post: 04-19-2013, 01:26 PM
  5. Front end changes
    By Guitarzan in forum Access
    Replies: 3
    Last Post: 08-06-2012, 06:39 AM

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