DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2012
    Location
    INDIA
    Posts
    2

    Create user type ID generate

    Hi,

    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
    Please help me.
    Attached Images

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,649
    What is the question?

    Is there a problem with the code you are using?
    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

  3. #3
    Join Date
    Jun 2012
    Location
    INDIA
    Posts
    2
    Quote Originally Posted by Hack View Post
    What is the question?

    Is there a problem with the code you are using?
    ----------------

    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....

    User : A
    ID : A/0001, A/0002...

    User : B
    ID : B/0001, B/0002...

    The question is How do I make user type ID

  4. #4
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,649
    Quote Originally Posted by biplob.shee View Post
    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

Similar Threads

  1. How to create a very simple crosstab type query
    By Ron Weller in forum Database
    Replies: 0
    Last Post: 10-02-2011, 04:32 PM
  2. Getting a GUI to run
    By Eric in forum Java
    Replies: 4
    Last Post: 04-14-2006, 09:09 AM
  3. I can't create a new user.
    By litqi in forum Enterprise
    Replies: 3
    Last Post: 04-19-2002, 06:45 PM
  4. Adding New NT User Account
    By John Whitney in forum VB Classic
    Replies: 2
    Last Post: 02-01-2001, 11:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links