Show combo box if check box checked

jpkeller

New member
Local time
Today, 09:31
Joined
Dec 16, 2004
Messages
7
I have a combo box that I would like to have hidden or visible based on the value of a check box. For example, The check box would prompt the user - "Do you want to override default?" If checked, combo1 box would appear and allow data entry. If the box is unchecked, the combo1 box would disappear.

I appreciate your help!
 
This should get you started:
Code:
Private Sub Check0_AfterUpdate()
  If Me.Check0 = True Then
    Me.Text2.Visible = True
  Else
    Me.Text2.Visible = False
  End If
End Sub
 
Thanks pbaldy!

This is working great. Can you help me figure out how to set the value of the combo box to null if the check box is unchecked? The functionality I am looking for will allow the user to enter a value in the combo box if the check box is marked, but if the check box is unchecked, the value of the combo box will be null.

Thanks so much for your help.

jpkeller
 
Me.ComboName = Null
 
Thanks again...that is working great. Obviously, I am a novice at this.

Happy Holidays!
 
jpkeller,

How did you get this to work. Can you write the code you exactly?
 
Hi. pbaldy.
I'm already used ur code and it's work nice. I used it to hide and unhide the command button. The problem is, when I open the form to insert the data, the button still unhide. when the check box is checked then unchecked...then command button hide.
 
You could try the same code in the current event, which would fire when the form opens and when changing records.
 
Thanks pbaldy.
It's work!!! :D
 
pbaldy
user_offline.gif

Registered User
Join Date: Aug 2003
Location: Nevada, USA
Posts: 5,329
reputation_pos.gif
reputation_pos.gif



Me.ComboName = Null
__________________
Paul
Microsoft Access MVP 2007


Can I use this code 4 subform? if not... anyway???
 
You people are still way ahead of me when it comes to coding....I'm still just starting out. I have been reviewing several of these posts and keep seeing "me.(command)"
So what does the [me.] represent in coding?
 
Me represents the object the code is in. IOW, if the code containing Me is in a form, Me refers to that form. Me.ControlName is a shortcut for Forms!FormName.ControlName, and also provides Intellisense, the dropdown providing you with various choices.
 
So that mean I have to use this code:

Me.RecordSource

where should I insert this code?
 
So that mean I have to use this code:

Me.RecordSource

where should I insert this code?
 
Wherever is appropriate to set the recordsource based on the needs of your application.
 

Users who are viewing this thread

Back
Top Bottom