J
Jessica
Hello All,
I tried this code in my database but keep getting a run-time error 3464
Data type mismatch in criteria expression. When I go and debug the code
it looks as if it is being directed to the correct report because
depending on which upc I select the DoCmd.OpenReport "report1",
acViewPreview, ,"UPC = " & lngUPC is highlighted. Does anyone have any
ideas of what might be wrong?
Private Sub cmdOpenReports_Click()
Dim varSelectedUPC As Variant
Dim lngUPC as Long
For Each varSelectedUPC In lstUPC.ItemsSelected
lngUPC = lstUPC.ItemData(varSelectedUPC)
Select Case lngUPC
Case 1111 to 3333
DoCmd.OpenReport "report1", acViewPreview, ,"UPC = " & lngUPC
'preview report; change to acViewormal to print immediately
Case 4444 to 6666
DoCmd.OpenReport "report2", acViewPreview, ,"UPC = " & lngUPC
Case Else
DoCmd.OpenReport "report3", acViewPreview, ,"UPC = " & lngUPC
End Select
Next varSelectedUPC
End Sub
TIA,
Jess
I tried this code in my database but keep getting a run-time error 3464
Data type mismatch in criteria expression. When I go and debug the code
it looks as if it is being directed to the correct report because
depending on which upc I select the DoCmd.OpenReport "report1",
acViewPreview, ,"UPC = " & lngUPC is highlighted. Does anyone have any
ideas of what might be wrong?
Private Sub cmdOpenReports_Click()
Dim varSelectedUPC As Variant
Dim lngUPC as Long
For Each varSelectedUPC In lstUPC.ItemsSelected
lngUPC = lstUPC.ItemData(varSelectedUPC)
Select Case lngUPC
Case 1111 to 3333
DoCmd.OpenReport "report1", acViewPreview, ,"UPC = " & lngUPC
'preview report; change to acViewormal to print immediately
Case 4444 to 6666
DoCmd.OpenReport "report2", acViewPreview, ,"UPC = " & lngUPC
Case Else
DoCmd.OpenReport "report3", acViewPreview, ,"UPC = " & lngUPC
End Select
Next varSelectedUPC
End Sub
TIA,
Jess