473,385 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Unique Id

geraldinegrieve
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 .
Jul 17 '08 #1
10 1686
debasisdas
8,127 Expert 4TB
How Are You Trying To Generate That ?
Jul 17 '08 #2
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
Jul 17 '08 #3
debasisdas
8,127 Expert 4TB
U Need To Use Format Function For That.
Jul 17 '08 #4
U Need To Use Format Function For That.
sorry for being such a pest but how and where do you mean format([uniqueID])
Jul 17 '08 #5
debasisdas
8,127 Expert 4TB
tell me first are you using VB 6.0
Jul 17 '08 #6
tell me first are you using VB 6.0
I am using Version 6.3
Jul 18 '08 #7
debasisdas
8,127 Expert 4TB
I am using Version 6.3
From where you got Visual Basic version 6.3 ???
Jul 18 '08 #8
From where you got Visual Basic version 6.3 ???
I just using the version from within access
Jul 18 '08 #9
9815402440
180 100+
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
Jul 20 '08 #10
Many Thanks for that sorry I didn''t reply sooner but out of office for a few days
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
Jul 23 '08 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: kevin parks | last post by:
hi. I've been banging my head against this one a while and have asked around, and i am throwing this one out there in the hopes that some one can shed some light on what has turned out to be a...
26
by: Agoston Bejo | last post by:
I want to enforce such a constraint on a column that would ensure that the values be all unique, but this wouldn't apply to NULL values. (I.e. there may be more than one NULL value in the column.)...
3
by: June Moore | last post by:
Hi, I would like to add a unique index that consists of two fields in a table. e.g. tbl_A (field1,field2) -- field1 & field2 Indexed and combination must be Unique. Can anyone tell me the...
5
by: Kamil | last post by:
Hello What should I use for better perfomance since unique constraint always use index ? Thanks Kamil
6
by: Bob Stearns | last post by:
I was under the impression that the primary key had to be a unique index. Since I usually create my primary indices before my primary keys, in order to get the indices in the same schema as their...
4
by: bwmiller16 | last post by:
Guys - I'm doing a database consistency check for a client and I find that they're building unique indexes for performance/query reasons where they could be using non-unique indexes. Note...
5
by: aj | last post by:
DB2 WSE 8.1 FP5 Red Hat AS 2.1 What is the difference between adding a unique constraint like: ALTER TABLE <SCHEMA>.<TABLE> ADD CONSTRAINT CC1131378283225 UNIQUE ( <COL1>) ; and adding a...
7
by: Brian Keating | last post by:
Hi there, Is it possible to add a unique constraint on two columns in a table, so that the constraint is a composite of the two? i.e. these two columns together should be unique...? i.e....
10
by: Laurence | last post by:
Hi there, How to differentiate between unique constraint and unique index? These are very similar but I cannot differentiate them? Could someone give me a hand? Thanks in advance
2
by: pstachy | last post by:
Hi again! I have another issue. I would like the attribute of the tag <invoice> to be unique. Made the following schema but unfortunately it doesn't validate. Could someone please indicate what is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.