I am facing a problem. I have created a multi user application in vb6 back end access database. I have a form where new records added and each record has an unique ID. SQL Statement is "SELECT * FROM TblRegistration ORDER BY ID".
The problem is when three users (Multiple user) enter the record at a time the ID is not unique and same ID generates. So I want to make the IDs combine with user type. Like...
User A
ID = A/0001, A/0002, A/0003 ....
User B
ID = B/0001, B/0002, B/0003 ....
I am giving the code for the ID GENERATE.
I am using the data control and it is easy for me.
Code:
Private Sub ID_GENERATE()
Data1.Refresh
Data1.RecordSource = "select * from TblRegistration order by ID"
Data1.Refresh
If Data1.Recordset.RecordCount > 0 Then
Data1.Recordset.MoveLast
' FC/11-12/ = 9 Character
X = Val(Mid(Data1.Recordset.Fields("ID"), 10)) + 1
Else
X = 1
End If
If X <= 9 Then
l2.Caption = "FC/11-12/0000" & X
ElseIf X <= 99 Then
l2.Caption = "FC/11-12/000" & X
ElseIf X <= 999 Then
l2.Caption = "FC/11-12/00" & X
ElseIf X <= 9999 Then
l2.Caption = "FC/11-12/0" & X
Else
l2.Caption = "FC/11-12/" & X
End If
End Sub
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site. Modifications Required For VB6 Apps To Work On Vista
No, actually the above code is better for a single user but when multiple user access at a time the code generates same ID. So I want to generate the ID of user type. like....
So I want to generate the ID of user type. like....
User : A
ID : A/0001, A/0002...
User : B
ID : B/0001, B/0002...
The question is How do I make user type ID
What is "user type"? How do you define that? Is it the name of the user?
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site. Modifications Required For VB6 Apps To Work On Vista
Bookmarks