How do I make I subform visible depending on the value selected in acombo box?

G

gmfbard

Hello,

On my main form there is a combo box containing five values. If the
user selects either value 1 or value 2, I want a subform to be
visible, otherwise the subform should not be visible. What code should
I put into the combo box 'after update' event to make this happen? Or
should I be focusing on the subform's "visible" property? Thanks for
your help.

George M.
 
A

Arvin Meyer [MVP]

How about something like:

Select Case Me.cboName
Case 1, 2
Me.SubformName.Visible = True
Case 3, 4, 5
Me.SubformName.Visible = False
Case Else

End Select
 
A

Arvin Meyer [MVP]

How about something like:

Select Case Me.cboName
Case 1, 2
Me.SubformName.Visible = True
Case 3, 4, 5
Me.SubformName.Visible = False
Case Else

End Select

You will also need to use similar code in the form's Current event to keep
your reults when scrolling through, or looking up records.
 
G

gmfbard

How about something like:

Select Case Me.cboName
Case 1, 2
Me.SubformName.Visible = True
Case 3, 4, 5
Me.SubformName.Visible = False
Case Else

End Select

You will also need to use similar code in the form's Current event to keep
your reults when scrolling through, or looking up records.

This works perfectly. Thank you for your help.

George M.
 
N

nybaseball22

George,

I have been working on a project like this for over a week. I have
gotten some great help in this news group. Try looking at these if
you want to take this a bit further. Arvin has been a great help in
these, as well.

http://groups.google.com/group/micr...g/browse_thread/thread/5444343c169d1c89?hl=en

http://groups.google.com/group/micr...g/browse_thread/thread/b504c8734e10f719?hl=en

And the latest, which I just started a new thread today.

http://groups.google.com/group/micr.../browse_thread/thread/625ecfcba2ab342d?hl=en#
 

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