how to make a condition in a report in access 2010 not to show a field

hi

i want to make a condition in access that if a field is equal zero not to show it in a the printable report
i put in the event current report this code:
if not retail >0 then
retail.visiable=false
end if
but it's not worked and the field is visiable anywah
bill201Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:
use the format event of the detail section ofthe report if [retail] is in the detail section

private sub detail_format(Cancel As Integer, FormatCount As Integer)

me.[retail].visible= not me.[retail]>0

end sub
bill201Author Commented:
it's not working but actually  i don't paste the entire code and maybe is this matter

this is my entire code includet what i try to do do accordingly you comment :

Private Sub detail_format(Cancel As Integer, FormatCount As Integer)


Dim d As String

d = Nz(DSum("retail", "orderdetailst", "orderid=" & Me.OrderID), 0)
If Not d > 0 Then
Me.[Retail].Visible = Not d > 0
End If
End Sub

and the dsum worked (i tried bfore)
Rey Obrero (Capricorn1)Commented:
change the name of the textbox to txtRetail


Private Sub detail_format(Cancel As Integer, FormatCount As Integer)


Dim d As Double  'change

d = Nz(DSum("retail", "orderdetailst", "orderid=" & Me.OrderID), 0)
If d > 0 Then
Me.[txtRetail].Visible = true
End If
End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.