I'm trying to clean up an Access program designed by someone else and I'm having some difficulty (regarding syntax) creating a condition for a field on a report.
I have the following case statement created and I wanted to be able to apply this logic to the field. It had been a nested IIf, but the previous guy's logic didn't work correctly. I tried putting this case in the "On Open" event of the report but it keeps telling me there's no value in [txtUNIT] so I'm assuming that the statement is running before the data is loaded on to the form, because I know there are values in that field. They display on the report...and it really didn't like it when I put it in the "Control Source" of the field, because I don't know the syntax or maybe it's just not possible.
Select Case [txtUNIT]
Case "ASST"
Report_CATALOG.PACK = ([PCS PER PACK] & " Asst"),
Case "BOX"
If([UsePCSPerPack] = -1 Then
(Report_CATALOG.PACK = ([PCS PER PACK] & " Pcs")
Else
(Report_CATALOG.PACK = ([PCS PER PACK] & " Box")
End If
Case "ROLL"
Report_CATALOG.PACK = ([PCS PER PACK] & " Roll(s)")
Case "CASE"
Report_CATALOG.PACK = ([PCS PER PACK] & " Case")
Case "CARD"
Report_CATALOG.PACK = ([PCS PER PACK] & " Card(s)")
Case "LBS"
Report_CATALOG_PDF.PACK = ([PCS PER PACK] & " lbs")
Case Else
Report_CATALOG.PACK = ([PCS PER PACK] & " Pc(s)")
End Select
--------------
Any help would be greatly appreciated.
Thanks
Justin
I have the following case statement created and I wanted to be able to apply this logic to the field. It had been a nested IIf, but the previous guy's logic didn't work correctly. I tried putting this case in the "On Open" event of the report but it keeps telling me there's no value in [txtUNIT] so I'm assuming that the statement is running before the data is loaded on to the form, because I know there are values in that field. They display on the report...and it really didn't like it when I put it in the "Control Source" of the field, because I don't know the syntax or maybe it's just not possible.
Select Case [txtUNIT]
Case "ASST"
Report_CATALOG.PACK = ([PCS PER PACK] & " Asst"),
Case "BOX"
If([UsePCSPerPack] = -1 Then
(Report_CATALOG.PACK = ([PCS PER PACK] & " Pcs")
Else
(Report_CATALOG.PACK = ([PCS PER PACK] & " Box")
End If
Case "ROLL"
Report_CATALOG.PACK = ([PCS PER PACK] & " Roll(s)")
Case "CASE"
Report_CATALOG.PACK = ([PCS PER PACK] & " Case")
Case "CARD"
Report_CATALOG.PACK = ([PCS PER PACK] & " Card(s)")
Case "LBS"
Report_CATALOG_PDF.PACK = ([PCS PER PACK] & " lbs")
Case Else
Report_CATALOG.PACK = ([PCS PER PACK] & " Pc(s)")
End Select
--------------
Any help would be greatly appreciated.
Thanks
Justin