Hi guys
I have spent the last 6 hours trying to get this VBA Query to work and it's about 98%...
Here is the code I am using (It's not pretty but it's the best I can do!):
mSerialNumber = DLookup("SerialNumber", "Workorders", "WorkorderID = " & Nz(Me.WorkorderID, 0) & "")
mSerialNumberSlash = mSerialNumber & mSeperator
mSerialNumberFinal = mSerialNumberSlash & mOrderNo
MsgBox "Your serial number is " & mSerialNumber & "."
MsgBox "Your serial number final with a space is " & mSerialNumberFinal & "."
sql = "Update Workorders SET [SerialNumber] = " & mSerialNumberFinal & " WHERE [WorkOrderID] = " & Me.WorkorderID & ";"
I am setting my variables correctly and I can see them via the Msgbox's I am displaying but I'm having stress with how to correctly code the mSerialNumberFinal variable in the SQL statement. This variable should contain some spaces but the spaces are being stripped out....
Any help is much appreciated.
Regards
Greg
I have spent the last 6 hours trying to get this VBA Query to work and it's about 98%...
Here is the code I am using (It's not pretty but it's the best I can do!):
mSerialNumber = DLookup("SerialNumber", "Workorders", "WorkorderID = " & Nz(Me.WorkorderID, 0) & "")
mSerialNumberSlash = mSerialNumber & mSeperator
mSerialNumberFinal = mSerialNumberSlash & mOrderNo
MsgBox "Your serial number is " & mSerialNumber & "."
MsgBox "Your serial number final with a space is " & mSerialNumberFinal & "."
sql = "Update Workorders SET [SerialNumber] = " & mSerialNumberFinal & " WHERE [WorkOrderID] = " & Me.WorkorderID & ";"
I am setting my variables correctly and I can see them via the Msgbox's I am displaying but I'm having stress with how to correctly code the mSerialNumberFinal variable in the SQL statement. This variable should contain some spaces but the spaces are being stripped out....
Any help is much appreciated.
Regards
Greg