Hide/Unhide Form in a Form depending on Combo Box Selection

Snowman88

Registered User.
Local time
Today, 03:03
Joined
Apr 4, 2007
Messages
26
Hello!

I am quite new to MS Access, so please bear with me ;)

Here is what i want to do:

I want to create a form, where you only see a Combobox with different entries. Let's say, that you have Cars, Bikes, Planes.

Now, when you choose one of those entries, a form becomes visible under the combo box. For example, when you choose Cars, there will be a form which has like 5 more boxes and some Command Buttons, all specific to the cars selection.


Any help appreciated :)
 
Rather than have different forms - you may like to consider having a generic form which covers all and then hide / unhide certain fields on that form which are not relevant to the category selected.

For example - if you select planes, the engine size would not be relevant as it would be for cars and bikes.

To do this you need to do it in the AfterUpdate property of the ComboBox

Col
 
Could you please give me a code example? I am really new to MS Access :( Need to get used to the VBA codes and everything :(
 
Something like

Code:
Me.YourFieldName.Visible = False

Look up the "visible" function in Access help

Col
 
Mmmh, everthing is working so far, but the problem is, that i need to overlap all those different forms and then it gets very messy...

Means: Right now, i have like 3 different forms on top of eachother and do a case combobox.value to make them visible or not....but this is very messy...any other solution?

Generic does not work, because the forms are all completly different...
 
If you're intent on going down the multi-form route, then I suggest you have an opening form where the user makes a selection (Bike / Plane / Car) and have the appropriate form open dependant on the selection.

Then have a button on that form to return to the opening form and close the data form so that there will always be only one form open.

Col
 
By the way - how many tables have you got for this data? Not 3 I hope.;)

Col
 
Hmmm, this sounds promising....now have to see if i can put this into code ;)

I have plenty of forms :D
 
I must admit, that i can not figure my error out by myself...

I have

Private Sub cboUpdateSelect_AfterUpdate()

Select Case cboUpdateSelect.Value


Case "Contact Person Details"

DoCmd.OpenForm (Form_frmUpdateContact)

Case "System Details"

DoCmd.OpenForm (Form_frmUpdateSystem)

End Select

End Sub



What am I missing in the syntax?
 
You've lost me now:confused:

I thought you just wanted to open and close a form dependant on what was selected in the ComboBox. . . . . . .

So you'd need something like this

Code:
If Me.ComboBoxName = "Plane" Then

DoCmd.Openform("FormName")

ElseIf Me.ComboBoxName = "Car" Then

etc 
etc
etc

Col
 
No, i didn't :)


Found the mistake...the " were missing...silly me ;)

Thanks for your help Col!
 

Users who are viewing this thread

Back
Top Bottom