Hello, I am trying to cascade some comboboxes for some forms, but I need to enter a string in, which is SQL, but it keeps coming up with a syntax error. I am just wondering what exactly I am doing wrong for this statement to keep getting flagged. Also, is there anyway to run a command on more than one line in Access vba?
Here is my code:
Code:
Private Sub CustomerNamecbo_AfterUpdate() Dim strSource As String
strSource = "SELECT tblPartInfo.PartNumber, tblPartInfo.PartNumber " & _
"FROM tblPartInfo " & _
"WHERE CustomerName = '" & Me.CustomerNamecbo & "' _
ORDER BY tblPartInfo.PartNumber"
Me.PartNumbercbo.RowSource = strSource
Me.PartNumbercbo = vbNullString
End Sub
Ignore the '_' at the end of some of the lines. I know that is wrong, I just put them here so it would be easier to view.