If Statement Against a Check Box

mmaki

New member
Local time
Today, 07:57
Joined
Aug 30, 2006
Messages
4
I'm trying to get the following If statement to work in a report:

Code:
Private Sub Report_Open(Cancel As Integer)
If Me.ChkPerm = Yes Then
   Me.txtBOX.BorderColor = 16711680
   Else 
   Me.txtBOX.BorderColor = 10711680
End If
End Sub

I can't get a valid "If" statement. I keep getting "You entered an expression that has no value."

What is the proper way to check an "if" statement against a check box?

Thanks,
 
try just using

If Me.ChkPerm Then
Me.txtBOX.BorderColor = 16711680
Else
Me.txtBOX.BorderColor = 10711680
End If
 
Try it in the format event of the appropriate section rather than the open event.
 
That gave the same result.

Here is what I am finding out. If I place the code in another procedure like "activate" I don't get the error, but it does me no good there. It has something to do with the "open" procedure. And it's the only procedure that will do what I need.
 
pbaldy, where might I find the format event of the appropriate section. I've looked and can't seem to find where else I might place this. Thanks for the response!
 
pbaldy Thanks! I found it. Section Detail...Event...On Format. That did it!!!!
 
Simplest way is to right click on the section (either the bar across the top of it or any empty area within it) in design view and click "Build Event". The appropriate section is of course the one containing the textbox.
 

Users who are viewing this thread

Back
Top Bottom