![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a form and want to append 3 values into another table using the following but can't seem to get the right syntax. Could someone please help out ? sSQL = "INSERT INTO DebitNote (DrNote_No, DrNote_Date, Cert_No) values (Me.Txt_DrNote_No, #me.DrNote_Date#, me.Cert_No)" DoCmd.RunSQL sSQL DrNote_No is a numeric field DrNote_Date is a date/time field Cert_No is a text field Thanks & Rgds, Prakash. |
#3
| |||
| |||
|
|
Prakash <sim... (AT) omantel (DOT) net.om> wrote innews:9c4bac4c-46cb-454a-adbe-c144e24d1dce (AT) u24g2000pru (DOT) googlegroups.co m: I have a form and want to append 3 values into another table using the following but can't seem to get the right syntax. Could someone please help out ? sSQL = "INSERT INTO DebitNote (DrNote_No, DrNote_Date, Cert_No) values *(Me.Txt_DrNote_No, #me.DrNote_Date#, me.Cert_No)" DoCmd.RunSQL sSQL DrNote_No is a numeric field DrNote_Date is a date/time field Cert_No is a text field Thanks & Rgds, Prakash. SQL cannot see the form so you have to put values not references to values. Try values (" & Me.txt_DrNote_No & "," & #me.DrNote_Date# & ",""" me.Cert_No & """)" -- Bob Q. PA is y I've altered my address. |
#4
| |||
| |||
|
|
On Oct 17, 2:54 pm, Bob Quintal <rquin... (AT) sPAmpatico (DOT) ca> wrote: Prakash <sim... (AT) omantel (DOT) net.om> wrote innews:9c4bac4c-46cb-454a-adbe-c144e24d1dce (AT) u24g2000pru (DOT) googlegroups.co m: I have a form and want to append 3 values into another table using the following but can't seem to get the right syntax. Could someone please help out ? sSQL = "INSERT INTO DebitNote (DrNote_No, DrNote_Date, Cert_No) values (Me.Txt_DrNote_No, #me.DrNote_Date#, me.Cert_No)" DoCmd.RunSQL sSQL DrNote_No is a numeric field DrNote_Date is a date/time field Cert_No is a text field Thanks & Rgds, Prakash. SQL cannot see the form so you have to put values not references to values. Try values (" & Me.txt_DrNote_No & "," & #me.DrNote_Date# & ",""" me.Cert_No & """)" -- Bob Q. PA is y I've altered my address. Thx Bob for such a quick response. I'm still getting a syntax error. Here's my final statement sSQL = "INSERT INTO DebitNote (DrNote_No, DrNote_Date, Cert_No) values (" & Me.txt_DrNote_No & "," & #me.DrNote_Date# & ",""" me.Cert_No & """)" It says "Compile error expected expression" and highlights the "hash" symbol just before the date. Here's another reason I switched to using parameters ... but that's another |
#5
| |||
| |||
|
|
I have a form and want to append 3 values into another table using the following but can't seem to get the right syntax. Could someone please help out ? sSQL = "INSERT INTO DebitNote (DrNote_No, DrNote_Date, Cert_No) values (Me.Txt_DrNote_No, #me.DrNote_Date#, me.Cert_No)" DoCmd.RunSQL sSQL DrNote_No is a numeric field DrNote_Date is a date/time field Cert_No is a text field Thanks & Rgds, Prakash. |
#6
| |||
| |||
|
|
Bob had a slight typo in his reply. It should have been values (" & Me.txt_DrNote_No & ",#" & me.DrNote_Date & "#,""" me.Cert_No & """)" That being said, I'd recommend using the following instead, to handle cases where the user has a non American Short Date format: values (" & Me.txt_DrNote_No & "," & Format(me.DrNote_Date, "\#yyyy\-mm\-dd\#") & ",""" me.Cert_No & """)" "Prakash" <sim... (AT) omantel (DOT) net.om> wrote in message news:9c4bac4c-46cb-454a-adbe-c144e24d1dce (AT) u24g2000pru (DOT) googlegroups.com... I have a form and want to append 3 values into another table using the following but can't seem to get the right syntax. Could someone please help out ? sSQL = "INSERT INTO DebitNote (DrNote_No, DrNote_Date, Cert_No) values *(Me.Txt_DrNote_No, #me.DrNote_Date#, me.Cert_No)" DoCmd.RunSQL sSQL DrNote_No is a numeric field DrNote_Date is a date/time field Cert_No is a text field Thanks & Rgds, Prakash.- Hide quoted text - - Show quoted text - |
#7
| |||
| |||
|
|
On Oct 17, 5:25*pm, "Douglas J Steele" NOSPAM_djsteele (AT) NOSPAM_gmail (DOT) com> wrote: Bob had a slight typo in his reply. It should have been values (" & Me.txt_DrNote_No & ",#" & me.DrNote_Date & "#,""" me.Cert_No & """)" That being said, I'd recommend using the following instead, to handle cas es where the user has a non American Short Date format: values (" & Me.txt_DrNote_No & "," & Format(me.DrNote_Date, "\#yyyy\-mm\-dd\#") & ",""" me.Cert_No & """)" "Prakash" <sim... (AT) omantel (DOT) net.om> wrote in message news:9c4bac4c-46cb-454a-adbe-c144e24d1dce (AT) u24g2000pru (DOT) googlegroups .com... I have a form and want to append 3 values into another table using the following but can't seem to get the right syntax. Could someone please help out ? sSQL = "INSERT INTO DebitNote (DrNote_No, DrNote_Date, Cert_No) values *(Me.Txt_DrNote_No, #me.DrNote_Date#, me.Cert_No)" DoCmd.RunSQL sSQL DrNote_No is a numeric field DrNote_Date is a date/time field Cert_No is a text field Thanks & Rgds, Prakash.- Hide quoted text - - Show quoted text - Thanks Douglas! I did encounter Bob's tiny typo but managed to work my way around it. Many thanks to you Bob ... you were a great help. Douglas, thanks for pointing out that caveat ... I'll give it a shot. Once again ... thanks everyone :-) Rgds, Prakash. |
![]() |
| Thread Tools | |
| Display Modes | |
| |