Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Nov 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    1) Adding a number to a string (2000)

    In a project I have combined parts of three strings (forename, surname and DOB) to create a 'Username' which will act as a primary key - However if two people have similar details it is possible to get an identical username. Does anyone know a code I can add to the end of the VB statement for the above which can add a two digit integer to the end of the username in the format ABCD01'00' Where the '00' indicated the number generated by the code. It would be helpful if this code was in running order I.e. If two people with similar details were added the first would be XXXXnn00 and the second XXXXnn01.
    Thanks

    James

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: 1) Adding a number to a string (2000)

    You could run an aggregate query to determine the number of records you are enquiring on.
    SELECT Count(*) FROM Tablename WHERE Fieldname like "ABCD01*"
    Where are you wating to do this, in code behind a form or what?
    Pat <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  3. #3
    New Lounger
    Join Date
    Nov 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Where I am Planning to do this...

    Yes it will be running in VB behind a form and will create the user name after updating any of the textboxes for names or date of birth assuming the other two are complete.

    Thanks Patt Ill try the code tommorow

    James

Posting Permissions

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