Bullsandbears123
Technical User
I have a sub, that inserts sql values into my table, the table has an autonumber and I'm not sure how to insert values with an autonumber. I keep getting a syntax error.
The table has id,txndate,txncode,synbol, etc. etc.
but the autonumber is the "ID" field. Please help. What is wrong with my code?
Private Sub btn_submit_Click()
Dim mysql
Dim strid As String
Dim strtxndate As String
Dim strtxncode As String
Dim strsymbol As String
Dim strprice As String
Dim strcommission As String
Dim strquantity As String
Dim strbroker As String
strid = "1"
strtxndate = "1"
strtxncode = "2"
strsymbol = "3"
strprice = "4"
strcommission = "5"
strquantity = "6"
strbroker = "7"
mysql = "INSERT [txndate], [txncode],[symbol], [price], [commission_per_share], [quantity], [broker] into tbl_trade_orders values(" & strtxndate & "," & strtxncode & "," & strsymbol & "," & strprice & "," & strcommission & "," & strquantity & "," & strbroker & ");"
CurrentDb.Execute mysql
The table has id,txndate,txncode,synbol, etc. etc.
but the autonumber is the "ID" field. Please help. What is wrong with my code?
Private Sub btn_submit_Click()
Dim mysql
Dim strid As String
Dim strtxndate As String
Dim strtxncode As String
Dim strsymbol As String
Dim strprice As String
Dim strcommission As String
Dim strquantity As String
Dim strbroker As String
strid = "1"
strtxndate = "1"
strtxncode = "2"
strsymbol = "3"
strprice = "4"
strcommission = "5"
strquantity = "6"
strbroker = "7"
mysql = "INSERT [txndate], [txncode],[symbol], [price], [commission_per_share], [quantity], [broker] into tbl_trade_orders values(" & strtxndate & "," & strtxncode & "," & strsymbol & "," & strprice & "," & strcommission & "," & strquantity & "," & strbroker & ");"
CurrentDb.Execute mysql