Control don't desapear

  • Thread starter Thread starter gatarossi
  • Start date Start date
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é.
 
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).
 
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é
 
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
 
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.
 
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.
 

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

Similar Threads


Back
Top