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

Setting in/visible fields using VB

Status
Not open for further replies.

jlrrush

MIS
Aug 3, 2004
9
US
I am creating a report that is using a query, and would like to have certain fields visible depending on if a field is null or not. For example:

If var2 is not null, then var1 should be invisible and var2 should be visible. If var2 is null, then var1 should be visible and var2 should be invisible.

I am planning on putting the code in the "OnOpen" event of the report, but as of now I have been unable to get the focus to var2 to set the visible property to true or false.
 
Try using the OnFormat event for whatever section this field is in. (presumably Details).

If IsNull(var2) Then
var1.Properties("Visible") = True
var2.Properties("Visible") = False
Else
var1.Properties("Visible") = False
var2.Properties("Visible") = True
End If

-Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top