Results 1 to 2 of 2

Thread: Multi users and DAO

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Columbia, SC USA
    Posts
    374
    I am using DAO with an Access 2000 database. One of the tables contains the field "Code", a numeric value. I use the following code to find the first number that is not found in the table (for certain reasons I can't use autonumber, otherwise this would not be a problem)

    Code:
    Dim NewCode as Integer
    
    NewCode = 1
    
    rsContacts.FindFirst "CODE = " & NewCode
    Do Until rsLogrosTipos.NoMatch = True
        rsLogrosTipos.FindFirst "CODE = " & NewCode
        If rsLogrosTipos.NoMatch = False Then
            NewCode = NewCode + 1
        End If
    Loop
    
    rsContacts.AddNew
    rsContacts.Fields("CODE") = NewCode
    rsContacts.Update
    The problem is that when there are 2 users logged in simultaneously and both of them add a record, both records are added with the same Code. I have tried various requery, refresh, etc. methods with no luck.

    Any help would be appreciated.

    Thank you,

    Andrew

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Columbia, SC USA
    Posts
    374
    Never mind! Found the answer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width