How do I hide a field if it equals zero in a .mdb form?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

On a .mdb form I wish to keep fields that result in zero from showing and
being printed on the record. Wayne Morgan helped me solve another problem
with zeros yesterday. Thanks.
 
On the on current event of the form enter the code that check if the value of
the field = 0 then visible = False

Me.FieldName.visible = (me.FieldName=0)
============================
or you can use

If me.fieldName = 0 then
me.fieldname.visible=false
else
me.fieldname.visible=true
end if
=============================
 
Sorry, but about this line
Me.FieldName.visible = (me.FieldName=0)

It should be
Me.FieldName.visible = (me.FieldName>0)
 
if your form is based on a query, you can enter the >0 in the criteria of the
query.

sam
 
I will try it. Ricker Alford

Ofer said:
On the on current event of the form enter the code that check if the value of
the field = 0 then visible = False

Me.FieldName.visible = (me.FieldName=0)
============================
or you can use

If me.fieldName = 0 then
me.fieldname.visible=false
else
me.fieldname.visible=true
end if
=============================
 
Mine is based on a query but when I put >0 in the criteria it gets rid of the
entire record since the first field in that record is a "zero"...
 
Me.FieldName.visible = (me.FieldName>0)

You took it out of context. It isn't meant to be a query criteria.

That line should go in the Form_Current event, to turn that specific
control/field invisible if its value is zero (and back again when it is
not). In a Report, the line would most likely go in the Detail_Format event
(or the Format event of the appropriate Report section).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top