My code is as follows:
Select Case Me.calcOverallRating
Case 0
Me.boxDoesNot.Visible = True
Case 0.5 To 1.4
Me.boxMeets.Visible = True
Case 1.5 To 2.4
Me.boxExceeds.Visible = True
Case 2.5 To 3
Me.boxOutstanding.Visible = True
Case Else
Me.boxDoesNot.Visible = False
Me.boxMeets.Visible = False
Me.boxExceeds.Visible = False
Me.boxOutstanding.Visible = False
End Select
--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
"Maverick" <Mave...@discussions.microsoft.com> wrote in message
news:100A6A7C-D6A8-453E...@microsoft.com...
--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
"Maverick" <Mave...@discussions.microsoft.com> wrote in message
news:6B0DB2CE-62E5-4D34...@microsoft.com...
If it is, in fact, a report, each report section has 3 events Format, Print,
and Retreat. To do what you are wanting to do, you should put your code in
the Format event of the report section the control you are populating is in.
Now, one other thing. What is appears you are doing is making either a
label or a text box with a value in it visible that will present a specific
message. If that is the case, I would do it differently. You really only
need one control. I would use a label and just change the caption. Also,
notice the difference in the Select Case statement. The Select Case executes
the first True case then jumps to the End Select, so you can use this style:
Select Case Me.calcOverallRating
Case 0
Me.lblRating.Caption = "Does Not Meet"
Case Is < 1.5
Me.lblRating.Caption = "Meets"
Case Is < 2.5
Me.lblRating.Caption = "Exceeds"
Case Is < 3
Me.lblRating.Caption = "OutStanding"
Case Else
Me.lblRating.Caption = vbNullString
End Select
--
Dave Hargis, Microsoft Access MVP
I have Access 2007, but am running it in compatability mode for 2002/2003
because my users have a mix of 2003 and 2007. The events for a report are
pretty much the same as for a form. The three events you mention do not exist
for me. I'm not sure how the difference is handled when 2003 tries to run the
events if they don't have the same events. However, that's a different bridge.
I can't put the event in On Format as it doesn't exist in 2007. Also, I have
four hidden rectangles that are used to highlight certain text when a
specific criteria is met. Thus, it is not captions with the words that I
need. The words are already there and I want the recangle to be visible
around the words when calcOverallRating is a certain value.
Thanks again for the input. Hopefully with this additional information my
request will be more clear.
Let's use the Detail section as an example.
In design view, right click on the bar that says Detail.
Click on Properties.
Select the Events tabl.
In order they are:
On Format
On Print
On Retreat
If you have users in both 2003 and 2007, you should be doing your
development in 2003.
When you are done and have stopped the code, be sure to remove the break
point by going back to that line and pressing F9 again to remove the
breakpoint and save the code; otherwise, it will continue to stop there.
Is calcOverallRating a control in the same section?
MsgBox "I am in the Detail Format Event"
I tried creating a blank database, turning AutoRename off, and importing the
old database in. That didn't help.
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
Debug.Print "Huh"
End Sub
I haven't installed Vista yet. I don't even have a computer that will
support it. My brother bought a lap top that came loaded with Vista and
became very frustrated, so he bought a different disk for it and loaded it
with XP.
I guess I'm going to have to have the report open in Print Preview instead
of Form View in order to make this work. I really would have liked this code
to trigger when the report opened so that it worked no matter what view.
Oh well. It's always good to stop the bleeding, no matter what kind of wound.
Thanks for sticking with me.