|
-
Jan 9th, 2000, 09:57 PM
#1
Thread Starter
Lively Member
Help!
I can't work out how to create an autonumber field!! I think it is set is the Attributes field, but that always seems to be read only!
-
Jan 10th, 2000, 12:30 PM
#2
Guru
what DB file type are you using? You should be able to specify this in the app that manipulates the DBs
-
Jan 11th, 2000, 11:08 AM
#3
New Member
It is correct that this is a database dependent problem. Microsoft access is the only db I know of that has a datatype known as autonumber. You set this as the datatype of the field when you are defining the table. SQL server has something similar but it is referred to as an Identity column. Oracle has no such built in datatype for a field. You instead need to use triggers along with something called a sequencer.
-
Feb 23rd, 2000, 06:08 PM
#4
Thread Starter
Lively Member
Sorry, dumb question!
If fld is a Field object then:
fld.Type = dbLong
fld.Attributes = dbAutoIncrField
gives you an Autonumbered Long Integer field.
Doh!
-
Feb 23rd, 2000, 06:16 PM
#5
Addicted Member
What is an "autonumber field"
Hi Could you clearly explain to me what is an Autonumber field ?
Thanks
-
Feb 23rd, 2000, 06:32 PM
#6
Thread Starter
Lively Member
Autonumber fields:
are of data type Long Integer
cannot contain duplicate values
automatically set their value to a long integer when a new record is added
are usually used as the primary key for a table.
-
Feb 23rd, 2000, 06:43 PM
#7
Addicted Member
Re Autonumber field
Sorry to be a bother, Why is it used, What is it's main purpose?
Thanks
-
Feb 23rd, 2000, 07:32 PM
#8
Thread Starter
Lively Member
No problem, but you'll have to excuse me- my explanation may not be very concise.
Basically if you want to link say a table of customers with a table of orders made by those customers, you could index your customer table with an autonumber field, eg:
ID, CustomerName (etc)
1 John Smith
2 Joe Bloggs
3 Fred Flintstone
Each time you add a customer, the record is allocated a unique number.
Now, in the orders table, we might have:
OrderNo, PartNo, CustomerNo (etc)
1,35,1
2,38,1
3,35,3 etc
In the orders table, the data in the fields PartNo and CustomerNo refer to fields in other tables which could be autonumber fields. The data tells us that John Smith has ordered PartNo 35 and 38 and Fred Flintstone wants PartNo 35.
Hope this helps 
Edited by benski on 02-24-2000 at 07:37 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|