Hi all, I am currently taking a class on Access and completely stumped on a VBA issue I am having. After talking to my instructor, I came to find out my code SHOULD BE working....
My task is to modify a report to suppress the printing of three controls that are based on a table when the control value is null. The controls are supposed to be suppressed ONLY when you print the report or view the report in Print Preview.
Here is the code I am using.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(PaymentID) Then
Me![PaymentID].Visible = False
Me![PaymentAmt].Visible = False
Me![PaymentDate].Visible = False
Me![lblPaymentID].Visible = False
Me![lblPaymentAmt].Visible = False
Me![lblPaymentDate].Visible = False
Else
Me![PaymentID].Visible = True
Me![PaymentAmt].Visible = True
Me![PaymentDate].Visible = True
Me![lblPaymentID].Visible = True
Me![lblPaymentAmt].Visible = True
Me![lblPaymentDate].Visible = True
End If
End Sub
It compiles fine but when I click out of design view and into Print Preview I get the "Run-Time error 438."
As I said, I am taking a class so I am incredibly green when it comes to VBA code but any help would be appreciated.
My task is to modify a report to suppress the printing of three controls that are based on a table when the control value is null. The controls are supposed to be suppressed ONLY when you print the report or view the report in Print Preview.
Here is the code I am using.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(PaymentID) Then
Me![PaymentID].Visible = False
Me![PaymentAmt].Visible = False
Me![PaymentDate].Visible = False
Me![lblPaymentID].Visible = False
Me![lblPaymentAmt].Visible = False
Me![lblPaymentDate].Visible = False
Else
Me![PaymentID].Visible = True
Me![PaymentAmt].Visible = True
Me![PaymentDate].Visible = True
Me![lblPaymentID].Visible = True
Me![lblPaymentAmt].Visible = True
Me![lblPaymentDate].Visible = True
End If
End Sub
It compiles fine but when I click out of design view and into Print Preview I get the "Run-Time error 438."
As I said, I am taking a class so I am incredibly green when it comes to VBA code but any help would be appreciated.