I'm using the following code to run a passthrough query. I'm trying to run the passthrough query, then check how many records are returned to figure out if it worked. But I get an error saying
"Invalid Operation"
Why is it doing this and how can I correct?
Dim Item As String
Item = InputBox("Enter Item needing a surrogate UPC.", "Enter Item")
Set db = CurrentDb
Set qdf = db.QueryDefs("spAL_AssignSurrogateUPC")
qdf.ReturnsRecords = True
qdf.SQL = "spAL_AssignSurrogateUPC '" & Item & "'"
With qdf.OpenRecordset(dbOpenSnapshot) '<--- Error triggered here.
If qdf.RecordCount = 1 Then
MsgBox "Surrogate UPC assigned."
Else
MsgBox "ERROR. Could not assign surrogate UPC."
End If
End With