D
David M. Fizer
Hi
I have this as a event procedure but recently change my table name to
tblProducts and field to strProductID. I was wondering where I am suppose
to put my table and field name in this code to get it working again.
Before my table and field were both called UPC. Also if I wanted to change
to a combo box could I still use the same event procedure?
TIA,
David
Private Sub Preview_Click()
0 Dim varSelectedUPC As Variant
Dim StrUPC As String
For Each varSelectedUPC In UPC.ItemsSelected
StrUPC = UPC.ItemData(varSelectedUPC)
Select Case StrUPC
Case "39000 48164"
DoCmd.OpenReport "Nestle T-Wing", acViewPreview, , "UPC = '" &
StrUPC & "'"
Case "06010 11292" To "06010 11588", "76808 52094", "76808 52138",
"95059 00046" To "95059 00051"
DoCmd.OpenReport "Barilla", acViewPreview, , "UPC = '" & StrUPC
& "'"
Case "MAR 001"
DoCmd.OpenReport "Mario", acViewPreview, , "UPC = '" & StrUPC &
"'"
'preview report; change to acViewormal to print immediately
Case "41129 07763" To "41129 27463"
DoCmd.OpenReport "Classico USA", acViewPreview, , "UPC = '" &
StrUPC & "'"
Case "27000 38534"
DoCmd.OpenReport "Hunts", acViewPreview, , "UPC = '" & StrUPC &
"'"
Case "77890 34286"
DoCmd.OpenReport "Wegmans Retort", acViewPreview, , "UPC = '" &
StrUPC & "'"
Case "41498 13419", "41498 13420", "41498 14507" To "41498 16612"
DoCmd.OpenReport "Aldi", acViewPreview, , "UPC = '" & StrUPC &
"'"
Case "50000 00000" To "50000 99999", "39000 12018", "39000 51550",
"39000 01792", "39000 42784"
DoCmd.OpenReport "Nestle", acViewPreview, , "UPC = '" & StrUPC &
"'"
Case "39400 01440" To "39400 01447"
DoCmd.OpenReport "Bush", acViewPreview, , "UPC = '" & StrUPC &
"'"
Case "290008 750820", "290008 750813"
DoCmd.OpenReport "Tostitos Israel", acViewPreview, , "UPC = '" &
StrUPC & "'"
Case "64200 32716" To "64200 32723", "57000 32723", "64200 32696"
DoCmd.OpenReport "Classico Canadian", acViewPreview, , "UPC = '"
& StrUPC & "'"
Case "74683 09916" To "74683 09925"
DoCmd.OpenReport "Emeril Canadian", acViewPreview, , "UPC = '" &
StrUPC & "'"
Case "74683 09800" To "74683 09803", "74683 09945" To "74683 09950"
DoCmd.OpenReport "Emeril USA", acViewPreview, , "UPC = '" &
StrUPC & "'"
Case "43800 45001" To "43800 45008"
DoCmd.OpenReport "Buitoni", acViewPreview, , "UPC = '" & StrUPC
& "'"
Case "39000 01190" To "39000 86552", "41501 01572"
DoCmd.OpenReport "Ortega", acViewPreview, , "UPC = '" & StrUPC &
"'"
Case "41498 14502" To "41498 14503"
DoCmd.OpenReport "Aldi Jugs", acViewPreview, , "UPC = '" &
StrUPC & "'"
Case "28400 00818", "28400 00822", "28400 02009", "28400 01939"
DoCmd.OpenReport "Tostitos", acViewPreview, , "UPC = '" & StrUPC
& "'"
Case "28400 00840", "28400 02462", "28400 03983"
DoCmd.OpenReport "Tostitos Con Queso", acViewPreview, , "UPC =
'" & StrUPC & "'"
Case "77644 90077" To "77644 90082"
DoCmd.OpenReport "Francesco Export", acViewPreview, , "UPC = '"
& StrUPC & "'"
Case "88267 00000" To "88267 04000", "88267 05000" To "88267 99999,"
DoCmd.OpenReport "Giant", acViewPreview, , "UPC = '" & StrUPC &
"'"
Case "Chataeu"
DoCmd.OpenReport "Chataeu", acViewPreview, , "UPC = '" & StrUPC
& "'"
Case "20662 00019" To "20662 00269"
DoCmd.OpenReport "Newmans Own", acViewPreview, , "UPC = '" &
StrUPC & "'"
Case "SAL 06101", "ZAN 06101"
DoCmd.OpenReport "No UPC", acViewPreview, , "UPC = '" & StrUPC &
"'"
Case "28400 00380"
DoCmd.OpenReport "Tostitos 28oz Jugs", acViewPreview, , "UPC =
'" & StrUPC & "'"
Case "28400 08415", "60410 04379", "60410 04362"
DoCmd.OpenReport "Tostitos 69oz Jugs", acViewPreview, , "UPC =
'" & StrUPC & "'"
Case "13000 59032" To "13000 59101"
DoCmd.OpenReport "Fridays", acViewPreview, , "UPC = '" & StrUPC
& "'"
Case "60410 90660"
DoCmd.OpenReport "Tostitos Con Queso Canadian", acViewPreview, ,
"UPC = '" & StrUPC & "'"
Case "60410 90642", "60410 90641", "60410 02545"
DoCmd.OpenReport "Tostitos Canadian", acViewPreview, , "UPC = '"
& StrUPC & "'"
Case "55000 18180" To "55000 18190"
DoCmd.OpenReport "Nestle Canadian", acViewPreview, , "UPC = '" &
StrUPC & "'"
Case "85239 40362" To "85239 40365"
DoCmd.OpenReport "Target", acViewPreview, , "UPC = '" & StrUPC &
"'"
Case Else
DoCmd.OpenReport "Others", acViewPreview, , "UPC = '" & StrUPC &
"'"
End Select
Next varSelectedUPC
End Sub
I have this as a event procedure but recently change my table name to
tblProducts and field to strProductID. I was wondering where I am suppose
to put my table and field name in this code to get it working again.
Before my table and field were both called UPC. Also if I wanted to change
to a combo box could I still use the same event procedure?
TIA,
David
Private Sub Preview_Click()
0 Dim varSelectedUPC As Variant
Dim StrUPC As String
For Each varSelectedUPC In UPC.ItemsSelected
StrUPC = UPC.ItemData(varSelectedUPC)
Select Case StrUPC
Case "39000 48164"
DoCmd.OpenReport "Nestle T-Wing", acViewPreview, , "UPC = '" &
StrUPC & "'"
Case "06010 11292" To "06010 11588", "76808 52094", "76808 52138",
"95059 00046" To "95059 00051"
DoCmd.OpenReport "Barilla", acViewPreview, , "UPC = '" & StrUPC
& "'"
Case "MAR 001"
DoCmd.OpenReport "Mario", acViewPreview, , "UPC = '" & StrUPC &
"'"
'preview report; change to acViewormal to print immediately
Case "41129 07763" To "41129 27463"
DoCmd.OpenReport "Classico USA", acViewPreview, , "UPC = '" &
StrUPC & "'"
Case "27000 38534"
DoCmd.OpenReport "Hunts", acViewPreview, , "UPC = '" & StrUPC &
"'"
Case "77890 34286"
DoCmd.OpenReport "Wegmans Retort", acViewPreview, , "UPC = '" &
StrUPC & "'"
Case "41498 13419", "41498 13420", "41498 14507" To "41498 16612"
DoCmd.OpenReport "Aldi", acViewPreview, , "UPC = '" & StrUPC &
"'"
Case "50000 00000" To "50000 99999", "39000 12018", "39000 51550",
"39000 01792", "39000 42784"
DoCmd.OpenReport "Nestle", acViewPreview, , "UPC = '" & StrUPC &
"'"
Case "39400 01440" To "39400 01447"
DoCmd.OpenReport "Bush", acViewPreview, , "UPC = '" & StrUPC &
"'"
Case "290008 750820", "290008 750813"
DoCmd.OpenReport "Tostitos Israel", acViewPreview, , "UPC = '" &
StrUPC & "'"
Case "64200 32716" To "64200 32723", "57000 32723", "64200 32696"
DoCmd.OpenReport "Classico Canadian", acViewPreview, , "UPC = '"
& StrUPC & "'"
Case "74683 09916" To "74683 09925"
DoCmd.OpenReport "Emeril Canadian", acViewPreview, , "UPC = '" &
StrUPC & "'"
Case "74683 09800" To "74683 09803", "74683 09945" To "74683 09950"
DoCmd.OpenReport "Emeril USA", acViewPreview, , "UPC = '" &
StrUPC & "'"
Case "43800 45001" To "43800 45008"
DoCmd.OpenReport "Buitoni", acViewPreview, , "UPC = '" & StrUPC
& "'"
Case "39000 01190" To "39000 86552", "41501 01572"
DoCmd.OpenReport "Ortega", acViewPreview, , "UPC = '" & StrUPC &
"'"
Case "41498 14502" To "41498 14503"
DoCmd.OpenReport "Aldi Jugs", acViewPreview, , "UPC = '" &
StrUPC & "'"
Case "28400 00818", "28400 00822", "28400 02009", "28400 01939"
DoCmd.OpenReport "Tostitos", acViewPreview, , "UPC = '" & StrUPC
& "'"
Case "28400 00840", "28400 02462", "28400 03983"
DoCmd.OpenReport "Tostitos Con Queso", acViewPreview, , "UPC =
'" & StrUPC & "'"
Case "77644 90077" To "77644 90082"
DoCmd.OpenReport "Francesco Export", acViewPreview, , "UPC = '"
& StrUPC & "'"
Case "88267 00000" To "88267 04000", "88267 05000" To "88267 99999,"
DoCmd.OpenReport "Giant", acViewPreview, , "UPC = '" & StrUPC &
"'"
Case "Chataeu"
DoCmd.OpenReport "Chataeu", acViewPreview, , "UPC = '" & StrUPC
& "'"
Case "20662 00019" To "20662 00269"
DoCmd.OpenReport "Newmans Own", acViewPreview, , "UPC = '" &
StrUPC & "'"
Case "SAL 06101", "ZAN 06101"
DoCmd.OpenReport "No UPC", acViewPreview, , "UPC = '" & StrUPC &
"'"
Case "28400 00380"
DoCmd.OpenReport "Tostitos 28oz Jugs", acViewPreview, , "UPC =
'" & StrUPC & "'"
Case "28400 08415", "60410 04379", "60410 04362"
DoCmd.OpenReport "Tostitos 69oz Jugs", acViewPreview, , "UPC =
'" & StrUPC & "'"
Case "13000 59032" To "13000 59101"
DoCmd.OpenReport "Fridays", acViewPreview, , "UPC = '" & StrUPC
& "'"
Case "60410 90660"
DoCmd.OpenReport "Tostitos Con Queso Canadian", acViewPreview, ,
"UPC = '" & StrUPC & "'"
Case "60410 90642", "60410 90641", "60410 02545"
DoCmd.OpenReport "Tostitos Canadian", acViewPreview, , "UPC = '"
& StrUPC & "'"
Case "55000 18180" To "55000 18190"
DoCmd.OpenReport "Nestle Canadian", acViewPreview, , "UPC = '" &
StrUPC & "'"
Case "85239 40362" To "85239 40365"
DoCmd.OpenReport "Target", acViewPreview, , "UPC = '" & StrUPC &
"'"
Case Else
DoCmd.OpenReport "Others", acViewPreview, , "UPC = '" & StrUPC &
"'"
End Select
Next varSelectedUPC
End Sub