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

Set visible to false on currency field depending on value 1

Status
Not open for further replies.

jazminecat

Programmer
Jun 2, 2003
289
US
Hi, I have a report where each record has an amendgrantawd field set to currency. For the records where that field is $0.00, I would like to set the visible property of that field to false. I have tried the following:

Code:
Private Sub Report_Open(Cancel As Integer)

'make the amendment invisible if it's zero

Dim AmendedVal As Currency

AmendedVal = Me.amendgrantawd

If AmendedVal > 0 Then
Me.amendgrantawd.Visible = True
Else
Me.amendgrantawd.Visible = False
End If

that throws an error that AmendedVal has no value.
taking that out and just using
Code:
If Me.amendgrantawd > 0 Then
Me.amendgrantawd.Visible = True
Else
Me.amendgrantawd.Visible = False
End If

give me the same error, that me.amendgrantawd has no value
I have also tried

If Me.amendgrantawd.text

which gives me the "you can't reference a property or method for a control unless the control has the focus" error.

If Me.amendgrantawd > 0#

also throws an error.

where am I going wrong here? thanks in advance for your help!


 
How about
If IsNull(amendgrantawd) or amendgrant = 0 then



-Pete
 
I would also move the code from the Report_open to whatever section its in Format section. such as: Private Sub Details_Format()



-Pete
 
Snyperx3, that did it. Move the code tot he details section. I overlook that far too often. thank you so much! have a star!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top