I have a combo box that on my main form that I want to refresh my subform, when I select my Vendor I get this error msg "Run-time error 3138- Syntax error in ORDER BY clause" and I don't understand why. Below is my code.
Dim strSQL As String
Dim strSQLSF As String
strSQLSF = " SELECT * FROM qryafehdr2 "
strSQLSF = strSQLSF & " WHERE qryafehdr2.Internal Order Number = " & Me.List20 & " And "
strSQLSF = strSQLSF & " qryafehdr2.VendorName = '" & List21 & "'"
Forms![Executive Look-Up Form]![Invoice_Header_Total_Exec subform1].LinkChildFields = ""
Forms![Executive Look-Up Form]![Invoice_Header_Total_Exec subform1].LinkMasterFields = ""
Forms![Executive Look-Up Form]![Invoice_Header_Total_Exec subform1].LinkChildFields = "Internal Order Number;VendorName"
Forms![Executive Look-Up Form]![Invoice_Header_Total_Exec subform1].LinkMasterFields = "Internal Order Number;VendorName"
Me.RecordSource = strSQLSF
Me.Requery
Dim strSQL As String
Dim strSQLSF As String
strSQLSF = " SELECT * FROM qryafehdr2 "
strSQLSF = strSQLSF & " WHERE qryafehdr2.Internal Order Number = " & Me.List20 & " And "
strSQLSF = strSQLSF & " qryafehdr2.VendorName = '" & List21 & "'"
Forms![Executive Look-Up Form]![Invoice_Header_Total_Exec subform1].LinkChildFields = ""
Forms![Executive Look-Up Form]![Invoice_Header_Total_Exec subform1].LinkMasterFields = ""
Forms![Executive Look-Up Form]![Invoice_Header_Total_Exec subform1].LinkChildFields = "Internal Order Number;VendorName"
Forms![Executive Look-Up Form]![Invoice_Header_Total_Exec subform1].LinkMasterFields = "Internal Order Number;VendorName"
Me.RecordSource = strSQLSF
Me.Requery