Combo Box

The Odd One

New member
Local time
Today, 19:08
Joined
May 14, 2004
Messages
8
I wanted to know how I could use a combo box that recieves it's information from one column in a table and make it open different forms based on the user's selection.
I have an average knowledge of how to use Access, but I don't know how to write code in it.
 
I haven't tested this but I imagine it will be something like this.

In the AfterUpdate event of the ComboBox put

Code:
If Me.ComboBoxName.Value = "YourValue" Then
DoCmd.Openform("FormName1")
ElseIf Me.ComboBoxName.Value = "YourValue2" Then
DoCmd.Openform("FormName2")
Else
DoCmd.OpenForm("FormName3")
End If

Col
 
Wow it worked.
Thank you.
I really appreciate the help.
 
Now I have another question of the same sort as the last one.
I want to use a combo box to display one field from my table and when the user picks from the combo box the other details show up on the fields on the form.
Thanks in advance.
 
After you add all the fields to your form, from the toolbox toolbar (make sure the wizards control box is pressed in) choose the combo box tool and draw a box on your form. From the choices the wizard gives you, choose "Find a record based on the value I selected in mycombo box." Just follow the wizard, it's pretty simple. Then if you want to add code you can go to the form module and modify the code that the access wizard generated. :cool:
 
I tried it out and it works, thanks.
The problem being is that I want to integrate two tables and that option doesn't seem to work with two tables.
Is there any way I can make it work with the information from the two tables?
 
Yes you can do it with two tables. Create a query that includes the two tables and base the form on the query. Make sure that the two tables have at least one field in each that relates the two like an id#. If you have not done this look up "relationships" in the help files to learn about how to create them.
 
Thanks for all the help, I really appreciate it.
I just have one more question, though.
Now that I created the combo box, you can see on the form, when you didn't select something from the combo box yet, the information of the first record. How can I make the other fields wait for the user to pick something from the combo box first?
Thanks in advance.
 
Put the following code in the form's On Open event:


DoCmd.GoToRecord acDataForm, "formname", acNewRec

This will take you to a new record at the end of the recordset. Then when you make a choice from the combo box it will populate the form with the details of your choice.
Hope this helps! :D
 
You are quite welcome!

The folks on this forum have helped me tremendously and I am more than happy to make this small contribution!!
 

Users who are viewing this thread

Back
Top Bottom