Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Show or Hide Controls on Form

Geek News

Show or Hide Controls on Form
"brydone via AccessMonster.com" <u12683[ at ]uwe> 11/11/2008 5:44:56 AM
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.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200811/1

Re: Show or Hide Controls on Form
"Allen Browne" <AllenBrowne[ at ]SeeSig.Invalid> 11/11/2008 6:48:09 AM
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.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"brydone via AccessMonster.com" <u12683[ at ]uwe> wrote in message
news:8d03ad7f8b441[ at ]uwe...
[Quoted Text]
>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.
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200811/1
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net