Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How To Do An INSERT into Auto Increment field?

Status
Not open for further replies.

oraclec

Programmer
Dec 8, 2002
16
0
0
SG
Hi everyone,

I am using MS Access for my database. I am doing some web based programming. I have an auto increment field in one of my tables. I would like to insert a record using SQL INSERT statement into the table.

What value do I insert for this auto increment field?

I tried ignoring the field altogether but it does not work.

Thanks for any help!

:D

==========================================================
Information alone is not knowledge nor can it grant wisdom or be put to use until it is properly applied.
==========================================================
 
With an insert query, if there is a field you want to ignore, you can specify a list of fields.

Thus:

Insert Into Table (Field1, Field2, Field3)
Values (Value1, Value2, Value3).

is what you need to do.

You don't need to specify all fields in the first line. Those that are autonumbers or have default values specified don't need value; neither do those that are optional.

John
 
Thanks! It works now.


|*Oraclec*|


==========================================================
Information alone is not knowledge nor can it grant wisdom or be put to use until it is properly applied.
==========================================================
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top