Insert Into with Autonumber PK

tl mike

Registered User.
Local time
Today, 02:47
Joined
Sep 7, 2007
Messages
117
I have an Insert into SQL which the records have a autnumber PK (OrderDetailPK) how would I go about skipping the PK to allow the insert into to work properly

strSQL = "Insert Into tblOrderDetail Values ('" & vrntNewOrderPK & "','" & !PartNumberFK & "'," & !DiscountedPrice & "," & (!QtyOrdered - Nz(!QtyShipped, 0)) & ",Null)"
 
Don't include the Autonumber field. It will automatically add it. Just insert any data to any field that is not the autonumber.
 
Oh, and your insert is lacking the field names to where things go -

Insert Into TableName (Field1, Field2, Field3) Values(Value1, Value2, Value3)
 
I knew it was something small I was missing.

Thanks for your help!!!
 

Users who are viewing this thread

Back
Top Bottom