Code on Reports?

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

I have this code on a form so that the user will know
where to enter the correct info:

If [WorkType-State] Like ("Proc MBLs" & "*") Then

Me.lbl_Phone.Caption = "% Obtain Amounts:"
Me.lbl_Online.Caption = "% Key Amounts:"
Me.lbl_Field.Caption = "% Match:"
Me.lbl_Map.Caption = "% Mail:"

Me.lbl_Phone.Visible = True
Me.lbl_Online.Visible = True
Me.lbl_Field.Visible = True
Me.lbl_Map.Visible = True
Me.lbl_Other.Visible = False
Me.lblTotal_.Visible = False
Me.Ctl_CompletedByPhone.Visible = True
Me.Ctl_CompletedByOnlineTool.Visible = True
Me.Ctl_CompletedByField_Search.Visible = True
Me.Ctl_CompletedByMap_Listing.Visible = True
Me.Ctl_CompletedByOther.Visible = False
Me.Total_.Visible = False


ElseIf [WorkType-State] Like ("Proc Exceptions"
& "*") Then
Me.lbl_Phone.Caption = "% Obtain Amounts:"
Me.lbl_Online.Caption = "% Key Amounts:"
Me.lbl_Field.Caption = "% Match:"
Me.lbl_Map.Caption = "% Mail:"

Me.lbl_Phone.Visible = True
Me.lbl_Online.Visible = True
Me.lbl_Field.Visible = True
Me.lbl_Map.Visible = True
Me.lbl_Other.Visible = False
Me.lblTotal_.Visible = False
Me.Ctl_CompletedByPhone.Visible = True
Me.Ctl_CompletedByOnlineTool.Visible = True
Me.Ctl_CompletedByField_Search.Visible = True
Me.Ctl_CompletedByMap_Listing.Visible = True
Me.Ctl_CompletedByOther.Visible = False
Me.Total_.Visible = False

Me.Box6.Visible = False
Me.Box5.Visible = False
Me.Box4.Visible = True
Me.Box3.Visible = False
Me.Box2.Visible = False
Me.Box1.Visible = False
Me.BoxOther.Visible = False

Plus a few more work types just like it. Is there a way
that I can minic this on a report? I just want the names
of the rows to change depending on the work type. Thanks!

Mike
 
Certainly. Put the code in the Print or Format event for the Detail Section
(or other Section where the Controls exist that you want to change).

Larry Linson
Microsoft Access MVP
 
Michael said:
I have this code on a form so that the user will know
where to enter the correct info:

If [WorkType-State] Like ("Proc MBLs" & "*") Then

Me.lbl_Phone.Caption = "% Obtain Amounts:"
Me.lbl_Online.Caption = "% Key Amounts:"
Me.lbl_Field.Caption = "% Match:"
Me.lbl_Map.Caption = "% Mail:"

Me.lbl_Phone.Visible = True
Me.lbl_Online.Visible = True
Me.lbl_Field.Visible = True
Me.lbl_Map.Visible = True
Me.lbl_Other.Visible = False
Me.lblTotal_.Visible = False
Me.Ctl_CompletedByPhone.Visible = True
Me.Ctl_CompletedByOnlineTool.Visible = True
Me.Ctl_CompletedByField_Search.Visible = True
Me.Ctl_CompletedByMap_Listing.Visible = True
Me.Ctl_CompletedByOther.Visible = False
Me.Total_.Visible = False


ElseIf [WorkType-State] Like ("Proc Exceptions"
& "*") Then
Me.lbl_Phone.Caption = "% Obtain Amounts:"
Me.lbl_Online.Caption = "% Key Amounts:"
Me.lbl_Field.Caption = "% Match:"
Me.lbl_Map.Caption = "% Mail:"

Me.lbl_Phone.Visible = True
Me.lbl_Online.Visible = True
Me.lbl_Field.Visible = True
Me.lbl_Map.Visible = True
Me.lbl_Other.Visible = False
Me.lblTotal_.Visible = False
Me.Ctl_CompletedByPhone.Visible = True
Me.Ctl_CompletedByOnlineTool.Visible = True
Me.Ctl_CompletedByField_Search.Visible = True
Me.Ctl_CompletedByMap_Listing.Visible = True
Me.Ctl_CompletedByOther.Visible = False
Me.Total_.Visible = False

Me.Box6.Visible = False
Me.Box5.Visible = False
Me.Box4.Visible = True
Me.Box3.Visible = False
Me.Box2.Visible = False
Me.Box1.Visible = False
Me.BoxOther.Visible = False

Plus a few more work types just like it. Is there a way
that I can minic this on a report? I just want the names
of the rows to change depending on the work type.

I don't know what you mean by "names of the rows", but if
you just want to change the captions of some label controls,
then you can use code very much like the above. Just make
sure that the code is in the Format event procedure of the
section containing the labels.
 
Have you tought of creating the entire report and than
setting visible property of the applicable text boxes to
yes or no.
Than you can use the shrink property to "remove" a line of
text boxes if the data is not applicable.
Hope this helps.
Fons
 
Back
Top