|
-
Apr 11th, 2000, 07:48 AM
#1
Thread Starter
Hyperactive Member
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
-
Apr 11th, 2000, 08:14 AM
#2
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|