D
David M. Fizer
Hello Everyone,
I have an event procedure which has a case statement that when a user
selects a record from a list box that a related report opens. I wanted to
make this easier to manage when new records are entered and need to choose
which report to use. Is there a way to add a field to my existing table
where after the end user enters in all the data for a product could enter
which report opens up when that record is selected.Below is the partial
case statement that I am using and can get very long and confusing when a
new record is added.
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 &
"'"
Case Else
DoCmd.OpenReport "Others", acViewPreview, , "UPC = '" & StrUPC &
"'"
End Select
Next varSelectedUPC
End Sub
TIA,
David
I have an event procedure which has a case statement that when a user
selects a record from a list box that a related report opens. I wanted to
make this easier to manage when new records are entered and need to choose
which report to use. Is there a way to add a field to my existing table
where after the end user enters in all the data for a product could enter
which report opens up when that record is selected.Below is the partial
case statement that I am using and can get very long and confusing when a
new record is added.
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 &
"'"
Case Else
DoCmd.OpenReport "Others", acViewPreview, , "UPC = '" & StrUPC &
"'"
End Select
Next varSelectedUPC
End Sub
TIA,
David