Control don't desapear

G

gatarossi

Dear all,

I'm getting crazy because this access!!!

I have a form called expenses and a subform linked with tge expenses
form called expenses_subform

In expenses_subform I have a textbox call period_1

When I open the expenses form I need that the textbox period_1 stay
invisible:

I put this code, but it doesn't work. Why?

Private Sub Form_Open(Cancel As Integer)

period_1.Visible = False

End Sub

Thanks

André.
 
M

Maurice

You don't have to set it to visible false in VBA on opening. You should set
the control property to visible = no and after that in code you have to set
it visble=true whenever appropriate (or when you decide it has te bo visbile
again).
 
G

gatarossi

Dear Maurice

This didn't work too.

Now by luck I think I have discovered the right code:

Private Sub Form_Open(Cancel As Integer)

With Me
.period_1.ColumnHidden = True
End With

End Sub

I think because it's in a subform I need to hidde the column. I don't
known, but it's work!

Thanks for your help!!!

André
 
W

Wayne-I-M

Hi

Have another ook at the advice given by Maurice as it is correct. If you
really want to code the visible then use the OnLoad

Private Sub Form_Load()
Me.period_1.Visible = False
End Sub

Although as Maurice has said there is no need for this to be coded
 
R

Rick Brandt

Dear Maurice

This didn't work too.

Now by luck I think I have discovered the right code:

Private Sub Form_Open(Cancel As Integer)

With Me
.period_1.ColumnHidden = True
End With

End Sub

I think because it's in a subform I need to hidde the column. I don't
known, but it's work!

Thanks for your help!!!

André

It has nothing to do with being a subform. It is because you are using
datasheet view. What you do to the controls you see in design view has little
to do with what happens in datasheet view.
 
M

Maurice

When andre mentioned hiding the column it came to mind that he was indeed
using datasheetview. Well as we saw he provided his own solution.
 
Top