Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

Unique Id

Question posted by: geraldinegrieve (Newbie) on July 17th, 2008 01:17 PM
I have a unique ID that looks like this ABCD0000ID e.g 3 letters, 6 digit number with leading zero's and I want to increment number by 1 each time automatically, but with a text format this doesn't seem possible. Any help much appreciated .
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
debasisdas's Avatar
debasisdas
Moderator
6,439 Posts
July 17th, 2008
01:19 PM
#2

Re: Unique Id
How Are You Trying To Generate That ?

Reply
geraldinegrieve's Avatar
geraldinegrieve
Newbie
7 Posts
July 17th, 2008
01:29 PM
#3

Re: Unique Id
Quote:
Originally Posted by debasisdas
How Are You Trying To Generate That ?

Thanks for your reply I am tryint to set it up in a unique id field on a form was thinking about dividing in 2 e.g. prefix and id but don't know how to generate leading 0's

Reply
debasisdas's Avatar
debasisdas
Moderator
6,439 Posts
July 17th, 2008
01:41 PM
#4

Re: Unique Id
U Need To Use Format Function For That.

Reply
geraldinegrieve's Avatar
geraldinegrieve
Newbie
7 Posts
July 17th, 2008
01:50 PM
#5

Re: Unique Id
Quote:
Originally Posted by debasisdas
U Need To Use Format Function For That.

sorry for being such a pest but how and where do you mean format([uniqueID])

Reply
debasisdas's Avatar
debasisdas
Moderator
6,439 Posts
July 17th, 2008
02:17 PM
#6

Re: Unique Id
tell me first are you using VB 6.0

Reply
geraldinegrieve's Avatar
geraldinegrieve
Newbie
7 Posts
July 18th, 2008
12:38 PM
#7

Re: Unique Id
Quote:
Originally Posted by debasisdas
tell me first are you using VB 6.0
I am using Version 6.3

Reply
debasisdas's Avatar
debasisdas
Moderator
6,439 Posts
July 18th, 2008
02:37 PM
#8

Re: Unique Id
Quote:
Originally Posted by geraldinegrieve
I am using Version 6.3

From where you got Visual Basic version 6.3 ???

Reply
geraldinegrieve's Avatar
geraldinegrieve
Newbie
7 Posts
July 18th, 2008
02:58 PM
#9

Re: Unique Id
Quote:
Originally Posted by debasisdas
From where you got Visual Basic version 6.3 ???

I just using the version from within access

Reply
9815402440's Avatar
9815402440
Member
111 Posts
July 20th, 2008
08:35 AM
#10

Re: Unique Id
hi

there are two ways out. first is add a numeric field in the table. this field will store numeric part of the id. now genrate id as follows
dim rst as new adodb.recordset
rst.open select max(numFiled) from table
unique id = "ABCD" & format(rst.fields(0).value,"0000#") & "ID"

second way is:
1. dim intCtr as integer
2. intCtr = (load intCtr value from registry or file etc. that is saved in line 5)
3. intCtr = intCtr+1
4. unique id = "ABCD" & format(intCtr,"0000#") & "ID"
5. save intCtr to registry or file etc.

hope this will help you

regards
manpreet singh dhillon hoshiarpur

Reply
geraldinegrieve's Avatar
geraldinegrieve
Newbie
7 Posts
July 23rd, 2008
12:00 PM
#11

Re: Unique Id
Many Thanks for that sorry I didn''t reply sooner but out of office for a few days
Quote:
Originally Posted by 9815402440
hi

there are two ways out. first is add a numeric field in the table. this field will store numeric part of the id. now genrate id as follows
dim rst as new adodb.recordset
rst.open select max(numFiled) from table
unique id = "ABCD" & format(rst.fields(0).value,"0000#") & "ID"

second way is:
1. dim intCtr as integer
2. intCtr = (load intCtr value from registry or file etc. that is saved in line 5)
3. intCtr = intCtr+1
4. unique id = "ABCD" & format(intCtr,"0000#") & "ID"
5. save intCtr to registry or file etc.

hope this will help you

regards
manpreet singh dhillon hoshiarpur

Reply
Reply
Not the answer you were looking for? Post your question . . .
180,430 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Top Visual Basic Forum Contributors