This should be easy, but something's wrong

Accessible92866

Registered User.
Local time
Today, 02:04
Joined
Nov 4, 2008
Messages
11
Hello all,

I have a report in Access 2007 that generates a sign-in sheet for monthly club meetings. Normally, the cost per meeting is $25 for members and $30 for non-members. However, this month is a special dinner meeting and the cost is ten dollars higher--$35 for members and $40 for non-members. This is the only thing that changes on the report.

I have two labels, one with each set of prices, stacked on top of each other. What I want to happen is that if the meeting date is 4/15/09, the regular price label should be invisible and the special price label should be visible. If I change the visibility manually, everything is fine, but I created an event procedure in the OnFormat property of the page header to make this happen, but it doesn't work. The regular label always displays, like it's not performing the If test.

Here's the code:

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)
If Me.MeetingDate = #4/15/2009# Then
Me.PriceLabel_Regular.Visible = False
Me.PriceLabel_Special.Visible = True
Else
Me.PriceLabel_Regular.Visible = True
End If
End Sub

Can anyone see what I'm doing wrong? (I'm pretty new at VB, so I'm still finding my way around in all this...)

Thanks for any help you can offer,
Accessible in California
 
I'm going to suggest that it should be in the detail section, unless of course all of the fields are in the header.

Also i would set the Special to False when I set the regular to True.

Brian
 
Where is the Me.MeetingDate located? In the page header?

Try putting a Break on the beginning of the Page header section and see if the code even runs.
 
Also be sure you are not just viewing the results in Form View but are actually calling the report, otherwise I don't think those events fire. To test just stick a button on a blank form and open the report that way.
 
Gentlemen,

I've tried all your suggestions and unfortunately, still no luck.

Yes, [MeetingDate] is in the page header, as are PriceLabel_Regular and underneath it, PriceLabel_Special. These are the labels located under the Amt Paid box. (See attached gif graphic of the header area.)

I tried writing an embedded macro, but that didn't work either.

It really looks like it's not even trying to run the If test. Any ideas why? I'm baffled.

Accessible92866
 

Attachments

  • SignInSheet.gif
    SignInSheet.gif
    3.6 KB · Views: 129
Break.gif

Did you try putting a break at the very beginning of the Page Header section? To see if that event is even firing? I know it doesn't fire at all if you just go from design view to form view or layout view, you have to actually call the form to open for that event to fire. I used to put code in the Print Event also, but 2007 doesn't have that event any more in Reports I don't think.
 
I don't have 2007 so cannot help directly, but have just tried a simple test in 2002 and it all works as expected.

Brian
 

Users who are viewing this thread

Back
Top Bottom