P
Pato-chan
I can't seem to weed out the syntax error in this SQL query, even after
pasting the syntax from the immediate window into Access's SQL Window. I
keep getting the "Enter Parameter Value" box with MCCR14D06 as the parameter
name, which is the value in lst.Column(1, varItem). Any ideas?
Private Sub cmdAddToBePrinted_Click()
Set lst = lstSelectParts
For Each varItem In lst.ItemsSelected
'Insert each of the selected items into the ToBePrinted table from
the tblKLOCLocations
strSQL = "INSERT INTO ToBePrinted ( Item_Number, KLOC_Location )
SELECT tblKLOCLocations.[Item Number], tblKLOCLocations.[KLOC LOCATION] FROM
tblKLOCLocations WHERE (((tblKLOCLocations.[Item Number])=" &
lst.ItemData(varItem) & ") AND ((tblKLOCLocations.[KLOC LOCATION])=" &
lst.Column(1, varItem) & "));"
Debug.Print strSQL
DoCmd.RunSQL strSQL
Next
End Sub
pasting the syntax from the immediate window into Access's SQL Window. I
keep getting the "Enter Parameter Value" box with MCCR14D06 as the parameter
name, which is the value in lst.Column(1, varItem). Any ideas?
Private Sub cmdAddToBePrinted_Click()
Set lst = lstSelectParts
For Each varItem In lst.ItemsSelected
'Insert each of the selected items into the ToBePrinted table from
the tblKLOCLocations
strSQL = "INSERT INTO ToBePrinted ( Item_Number, KLOC_Location )
SELECT tblKLOCLocations.[Item Number], tblKLOCLocations.[KLOC LOCATION] FROM
tblKLOCLocations WHERE (((tblKLOCLocations.[Item Number])=" &
lst.ItemData(varItem) & ") AND ((tblKLOCLocations.[KLOC LOCATION])=" &
lst.Column(1, varItem) & "));"
Debug.Print strSQL
DoCmd.RunSQL strSQL
Next
End Sub