M
Mike Green
Hi All
I am trying to insert information from a form into a table. I need to
insert just the information from the displayed record. I am using a command
button to run the SQL but I want to pass the current record number from the
open form to the SQL to send to the table. If I delete the "(RecordNo)" and
substitute just the actual record number all works fine so what is the
syntax I should use? I hav'nt used access for a while so obviously I am a
bit rusty, Please help!
Regards in advance
Mike
******************CODE*****************
Dim strSQLCreateInvoice As String
Dim RecordNo As String
RecordNo = Me.FdJobCardID
'Create the invoice
strSQLCreateInvoice = "INSERT INTO TblInvoice ( FdJobCardRef," & _
"FdInvoiceJCNo, FdInvoiceJobCardClosedDate, FdInvoiceCustomerOrderNo )" & _
"SELECT TblJobCard.FdJobCardID AS FdJobCardRef, " & _
"TblJobCard.FdJobCardNumber AS FdInvoiceJCNo, " & _
"TblJobCard.FdJobCardCloseDate AS FdInvoiceJobCardClosedDate, " & _
"TblJobCard.FdCustomerOrderNo AS FdInvoiceCustomerOrderNo " & _
"FROM TblJobCard " & _
"WHERE (((TblJobCard.FdJobCardID)= (RecordNo)));"
CurrentDb.Execute strSQLCreateInvoice
I am trying to insert information from a form into a table. I need to
insert just the information from the displayed record. I am using a command
button to run the SQL but I want to pass the current record number from the
open form to the SQL to send to the table. If I delete the "(RecordNo)" and
substitute just the actual record number all works fine so what is the
syntax I should use? I hav'nt used access for a while so obviously I am a
bit rusty, Please help!
Regards in advance
Mike
******************CODE*****************
Dim strSQLCreateInvoice As String
Dim RecordNo As String
RecordNo = Me.FdJobCardID
'Create the invoice
strSQLCreateInvoice = "INSERT INTO TblInvoice ( FdJobCardRef," & _
"FdInvoiceJCNo, FdInvoiceJobCardClosedDate, FdInvoiceCustomerOrderNo )" & _
"SELECT TblJobCard.FdJobCardID AS FdJobCardRef, " & _
"TblJobCard.FdJobCardNumber AS FdInvoiceJCNo, " & _
"TblJobCard.FdJobCardCloseDate AS FdInvoiceJobCardClosedDate, " & _
"TblJobCard.FdCustomerOrderNo AS FdInvoiceCustomerOrderNo " & _
"FROM TblJobCard " & _
"WHERE (((TblJobCard.FdJobCardID)= (RecordNo)));"
CurrentDb.Execute strSQLCreateInvoice