Show or Hide Controls on Form

  • Thread starter brydone via AccessMonster.com
  • Start date
B

brydone via AccessMonster.com

I am setting up a very simple database in Access 2003 which will keep track
of various bits of equipment. I have a drop-down combo called "InFrom" that
will show where the equipment has come from and beside it I have a text box
"Other" which will contain the further details. The combo has the following
options: Local, Import, Other. If I select Local or Imported, I would like
the "Other" field to remain hidden. However, only If I select Other from the
drop-down, I would like the "Other field to become visible for entry.

I have tried several combinations of:

Private Sub InFrom_AfterUpdate()
If Me.InFrom = "Other" Then
Me.Other.Visible = True
Else
Me.Other.Visible = False
End If
End Sub

This works on the first entry only and from that point forward the "Other"
fiels is constantly being displayed.

Is there anything that I can do to cure this?

Many thanks in anticipation.
 
A

Allen Browne

Use the Current event of the form as well:
Private Sub Form_Current()
Call InFrom_AfterUpdate
End Sub

Note that you will need to add error handling in case Other has focus when
you try to hide it while moving records.
 

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