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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't preview the report after adding event procedure coding

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi, All:

I'm trying to shrink the labels to controls that the values of the controls are NULL. In detail section - On Format - [Event Procedure]..., I added the following code that was posted in previous thread by Gord:

If IsNull(Me![NameOfFieldThatMightBeNull]) Then
Me![NameOfLabel].Visible = False
Else
Me![NameOfLabel].Visible = True
End If

But I could not preview the report after adding the code above in the design view.

Advice would be greatly appreciated.

Kay
 
Hey there. I cant find anything wrong with your code. Below I have what u used and what I did in a test I ran. Mine works fine and is identicle. My guess is something else is wrong (it's bad because then you might have to rebuild the report), or you have a sintax error somewhere. Access 97 here by the way.

Yours:
If IsNull(Me![NameOfFieldThatMightBeNull]) Then
Me![NameOfLabel].Visible = False
Else
Me![NameOfLabel].Visible = True
End If

Mine:
If IsNull(Me.Text1) Then
Me.Label1.Visible = False
Else
Me.Label1.Visible = True
End If
 
Not sure why you can't preview the report, but boolean logic will cut your code from this:

If IsNull(Me![NameOfFieldThatMightBeNull]) Then
Me![NameOfLabel].Visible = False
Else
Me![NameOfLabel].Visible = True
End If


To this:

Me.Label.Visible = Not IsNull(Me.Field)

I tested in on a report, and worked just fine.


Jim Lunde
compugeeks@hotmail.com
We all agree your theory is crazy, but is it crazy enough?
 
Hi, mflancour and Jim:

Thank you two for your response. I made a silly mistake. The text name should be TextXXX, rather than the actual field name. Now My report works. Thank you all to reply my question.

kay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top