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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INSERT INTO( AUTONUMBER)

Status
Not open for further replies.

Bullsandbears123

Technical User
Feb 12, 2003
291
US

I'm still having some problems with my sql, it stated to few parameters. I have on extra field called "ID" and it is an autonumber. How can I fix this?


mysql = "INSERT into tbl_trade_orders([txndate], [txncode], [symbol], [quantity], [price], [commission_per_share], [broker]) values(" & strtxndate & "," & strtxncode & "," & strsymbol & "," & strquantity & "," & strprice & "," & strcommission & "," & strbroker & ");"
CurrentDb.Execute mysql
 
try adding a ' to each side of the string:

mysql = "INSERT into tbl_trade_orders([txndate], [txncode], [symbol], [quantity], [price], [commission_per_share], [broker]) values('" & strtxndate & "','" & strtxncode & "','" & strsymbol & "','" & strquantity & "','" & strprice & "','" & strcommission & "','" & strbroker & "');"
CurrentDb.Execute mysql




Leslie
 
Change the double-quotes(") inside of the value area of your SQL to single quotes('). You see you are building a string here with beginning and ending double-quotes. The internal double-quotes are confusing to the interpreter.

Give this a try and get back with your results.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
lespaul has stated it a little better than myself but the effect is the same. Sorry for stepping on your answer lespaul, I was typing as fast as I could.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
yeah, well bob, after we've answered this same question about 10 times in the last week alone, not surprising that we double posted!

I think every regular here whether they know SQL or not, now knows that you have to surround a string with single quotes!

Leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top