G
Guest
I'm having difficulty with SQL code in a module. I am trying to use the
variable "concatquoteheader" in the SQL code, but the SQL code doesn't appear
to accept it. When I call the function "callconcatquote" from a macro, a box
appears and asks to input "concatquoteheader" (much like a parameter).
I replaced "concatquoteheader" with the literal "2" and the SQL code works
fine (updates a field in a table).
Here's the code (Forms![frmSalesJob]![quoteheader] is a form text box and
tblSalesJobMastQuotes.quoteheader is a memo field in a table):
Option Compare Database
++++++++++++++
Public Sub ConcatenateHeader()
Dim concatquoteheader As String
Dim header1 As String
Dim header2 As String
header1 = Mid(Forms![frmSalesJob]![quoteheader], 1, 250)
header2 = Mid(Forms![frmSalesJob]![quoteheader], 251, 250)
concatquoteheader = header1 & header2
DoCmd.RunSQL "UPDATE tblSalesJobMastQuotes SET
tblSalesJobMastQuotes.quoteheader = concatquoteheader WHERE
(((tblSalesJobMastQuotes.documentnumber)=[Forms]![frmSalesJob]![salesnumber]
& [Forms]![frmSalesJob]![documentversion]))"
End Sub
++++++++++++++
Public Function callconcatquote()
Call ConcatenateHeader
End Function
++++++++++++++
Any help that you can provide is welcome. Thanks in advance.
Regards,
Gary
variable "concatquoteheader" in the SQL code, but the SQL code doesn't appear
to accept it. When I call the function "callconcatquote" from a macro, a box
appears and asks to input "concatquoteheader" (much like a parameter).
I replaced "concatquoteheader" with the literal "2" and the SQL code works
fine (updates a field in a table).
Here's the code (Forms![frmSalesJob]![quoteheader] is a form text box and
tblSalesJobMastQuotes.quoteheader is a memo field in a table):
Option Compare Database
++++++++++++++
Public Sub ConcatenateHeader()
Dim concatquoteheader As String
Dim header1 As String
Dim header2 As String
header1 = Mid(Forms![frmSalesJob]![quoteheader], 1, 250)
header2 = Mid(Forms![frmSalesJob]![quoteheader], 251, 250)
concatquoteheader = header1 & header2
DoCmd.RunSQL "UPDATE tblSalesJobMastQuotes SET
tblSalesJobMastQuotes.quoteheader = concatquoteheader WHERE
(((tblSalesJobMastQuotes.documentnumber)=[Forms]![frmSalesJob]![salesnumber]
& [Forms]![frmSalesJob]![documentversion]))"
End Sub
++++++++++++++
Public Function callconcatquote()
Call ConcatenateHeader
End Function
++++++++++++++
Any help that you can provide is welcome. Thanks in advance.
Regards,
Gary