How to Hide field in subform

G

Guest

I have subform and need to make a couple of fields be NOT visible depending
on the "Control" variable: 1 - show, 0 no.

In the subform, I have a field named Unit_Price,. had the following code in
the "Current" event procedure. When I ran the form, the Unit Price field
remains displayed. I then debug it bu walking thru each step of the code. In
spite of the "Me.Form.Parent.Show " value = 0 and the Me.Unit_Price.Visible =
False
was executed by using step-by-step execution, the Unit Price field still
Visible.

Can someone please tell me if I'm correctly doing this to hide the field in
a subform ?

Private Sub Form_Current()
If Me.Form.Parent.Show then
Me.Unit_Price.Visible = True
Else
Me.Unit_Price.Visible = False
endif
End Sub
 
A

Alex Dybenko

Hi,
in what view you have subform opened? for datasheet you have to use
ColumnWidth and columnhidden properties.
Furthermore - I think better to put such code into main form current event,
or Show control AfterUpdate, if it is not bound

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
 

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

Top