Report Code Select Case Problem... (1 Viewer)

Mitch_____W

Mitch
Local time
Today, 13:36
Joined
Oct 31, 2001
Messages
73
I am trying to have an image be visible on a Report only when a certain textbox on the report is a certain value..

I tried the code below and I get a Run Time Error '2427' "You entered an expression that has no value."

Report Code:

---------------------------------
Private Sub Report_Open(Cancel As Integer)

Select Case (text64)

Case "M. Wilson"
Me!Image63.Visible = True

End Select

End Sub
------------------------------

What is the problemo???


Thanks in advance!!!

Mitch
 

Robert Dunstan

Mr Data
Local time
Today, 18:36
Joined
Jun 22, 2000
Messages
291
Try this:

Private Sub Report_Open(Cancel As Integer)

Select Case text64.Value

Case "M. Wilson"
Me!Image63.Visible = True

End Select

End Sub

HTH
Rob
 

Mitch_____W

Mitch
Local time
Today, 13:36
Joined
Oct 31, 2001
Messages
73
Tried it... Get same error message...

It seems like a simple procedure... Does it have anything to do with the fact that it is a REPORT code module? Are there differences between FORM and REPORT modules as to what you can and cannot do?


Stumped!

Mitch
 

Mitch_____W

Mitch
Local time
Today, 13:36
Joined
Oct 31, 2001
Messages
73
Ok I figured it out...

I was using the <On Open> event, when I should have been using the <On Activate> event. I guess with the <On Open> event all of the report values do not exist until after the code behind the <On Open> event.

Mitch
 

Robert Dunstan

Mr Data
Local time
Today, 18:36
Joined
Jun 22, 2000
Messages
291
Hi Mitch

Glad you sorted it.

You were right to place the code in OnActivate event. Basically the order in which the code is executed is:
Load Event ---> Activate Event.
 

Users who are viewing this thread

Top Bottom