Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OnFormat event in Report Detail not firing

Status
Not open for further replies.

neualex

Programmer
Feb 26, 2008
53
US
Folks,

I am using MSOffice 2010 (and I tried on MSAccess 2007 as well) and I have a really simple task on a report. Based on a field value, I changed the text on a couple of captions.

Now, if I remove the field condition, the report gets printed, if I include it, the report seems to go to a black hole.

Here is the code on the OnFormat event:

If (Me.Verified) Then
Me.lblEmailOpt.Caption = "Yes, it is verified"
End If

If (Me.Audited) Then
Me.lblIdOpt.Caption = "Yes, is audited with expiration date " & Me.ExpirationDate
End If

I call the report from the form using the code below:

Dim reportName As String
Dim reportCondition As String

reportName = "rptMembershipForm1A"
reportCondition = "[MemberNumber] = " & [MemberNumber]

DoCmd.OpenReport reportName, acNormal, , reportCondition

What am I doing wrong??

...Alex
 
I wouldn't probably use VBA. Consider changing the label to a text box with a control source of:
Code:
=IIf(Verified,"Yes, it is verified","Not verified")
=IIf (Audited,"Yes, is audited with expiration date " & ExpirationDate, "Not audited")


Duane
Hook'D on Access
MS Access MVP
 
Thank you! It worked!

However, I wonder why the report is not printed nor displayed by using conditions on the Report-Detail events?

Strange, don't you think?

...Alex
 
No, I don't. Is it required?

So, if I have several conditions to do based on fields, I have to create dummy controls, bound them to the fields in question so I can use them with VBA?

...Alex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top