phiberdelic
Technical User
I need help with this statement. I am getting "Expected end of statement" at " AND (PONumber BETWEEN "...please advise as to what I am doing wrong here I am not proficient in SQL statements and am just winging it.
If chkDateRange.Value <> 0 And chkPORange.Value <> 0 And chkLocation.Value <> 0 Then
rsRecordset.Open "INSERT INTO tblDataHold(Vendor), tblDataHold(PONumber)," & _
" tblDataHold(ReceiptDate), tblDataHold(Location) SELECT Vendor, PONumber," & _
" ReceiptDate, Location FROM ReceivingsHeader WHERE ((Vendor=" & cmbVendors.Value & _
" AND (Location=" & lstLocation.value " AND (PONumber BETWEEN " & txtFromPO.value " AND " & txtToPO.value "And (ReceiptDate " & _
"between " & txtStartDate.value " and " & txtEndDate.value ")" & _
, cnCurrent, adOpenDynamic, adLockOptimistic;
End If
If chkDateRange.Value <> 0 And chkPORange.Value <> 0 And chkLocation.Value <> 0 Then
rsRecordset.Open "INSERT INTO tblDataHold(Vendor), tblDataHold(PONumber)," & _
" tblDataHold(ReceiptDate), tblDataHold(Location) SELECT Vendor, PONumber," & _
" ReceiptDate, Location FROM ReceivingsHeader WHERE ((Vendor=" & cmbVendors.Value & _
" AND (Location=" & lstLocation.value " AND (PONumber BETWEEN " & txtFromPO.value " AND " & txtToPO.value "And (ReceiptDate " & _
"between " & txtStartDate.value " and " & txtEndDate.value ")" & _
, cnCurrent, adOpenDynamic, adLockOptimistic;
End If