Hide combo box's until required.

Foster

Registered User.
Local time
Today, 05:25
Joined
Jul 16, 2003
Messages
19
Hi All,
Firstly, I have tried looking through the forum but didn't really know what to search for. I apologise if it has been asked for (many times) before.

I have a form with 7 combo boxes on it (To pick materials from tblmaterials)
What I need is for the first combo box to appear when the form is opened. Then, if a material is picked in the first combo box, then the second combo to appear...and so on.

Is this possible?

Any help, gratefully received.

F.
 
In the AfterUpdate Event of your first Combo put code like..
Code:
Me.YourSecondCombo.Visible = true
and in the AfterUpdate Event of the Second Combo..
Code:
Me.YourthirdCombo.Visible = true
and so on. In the OnOpen event of the form have..
Code:
Me.YourSecondCombo.Visible = false
Me.YourThirddCombo.Visible = false
Me.YourFourthCombo.Visible = false
'etc etc.

HTH
IMO
 
The OnOpen Event will only work for the record that appears when you first open the form. It will not work if you scroll through the records. Also, you'll need to add a bit more coding (see below) in case there is data in the combo boxes and you want to change the second (or third) combo box value.

I would suggest putting the following code in the OnCurrent Event for the Form (triggered when you open a form or scroll through records one-by-one):

Me.YourSecondCombo.Enabled = Not IsNull(Me.YourFirstCombo)
Me.YourThirdCombo.Enabled = Not IsNull(Me.YourSecondCombo)

etc...

Finally, me thinks your database is Un-Normalised. You might be better off normalising it. What if you needed 8 materials???
:)
 
Thanks for both the replies. I will try it out later. But............

"Finally, me thinks your database is Un-Normalised. You might be better off normalising it"


Excuse my ignorance but what does "Un-normalised" mean?

As in many others, still finding my way round access.

Thanks in advance.

F.
 
Do a search here for normalization, there are many posts here explaining how to normalize a DB.

HTH
IMO
 
If you've named your combo's consecutively i.e. Combo1, Combo2 then you can reduce the seven lines to set them to visible.

Code:
Dim i As Integer
For i = 1 To 7
    Me.Controls("Combo" & i).Visible = True
Next i
 

Users who are viewing this thread

Back
Top Bottom