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!

Access Report Coding 2

Status
Not open for further replies.

MichaelF81

Programmer
Sep 20, 2005
178
US
Ok, I have a report in Access. When it runs, I want some actions to take place.

Essentially, on the report the 2 labels are text71 and text 72.

Code:
Dim strValue1
Dim strValue2

strValue1 = Me.Text71
strValue2 = Me.Text71a

If strValue1 < strValue2
Me.Text71 = strValue2
Else
Me.Text71 = strValue1
End If

Since Text71 can be null, it errors out. I am having issues with the IsNull command. Any ideas?







"Adults are just obsolete children and the hell with them." - Dr. Seuss
 
I tend to cast nulls by converting them to stringa and then using the Val() function. Try this:
[small]
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

lblCalc.Caption = iif(Val(Text71 & "")<Val(Text71a & ""), Round(Val(Text71 & "")), Round(Val(Text71a & "")))
lblCalc1.Caption = iif(Val(Text77 & "")<Val(Text71a & ""), Round(Val(Text77 & "")), Round(Val(Text77a & "")))

End Sub
[/small]

You can make zeros appear as blanks by setting the format property on the report's text box to 0;(0);""

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top