using combo box to select form to open

  • Thread starter Thread starter CFP - Russell
  • Start date Start date
C

CFP - Russell

Guest
Hello,

I am trying to create a form with the following steps however I do not know how to code it. Any help anyone can give me would be greatly appreciated.

I want to have a form where the user selcects the type of workorder they want
via a combobox then presses a button to open the workorder form.

I have 7 seperate workorder forms and I would like to be able to open the form based on the selection in the combo box.

The combo box's source would be in a seperate table where I would have a column in the table for the form name that I wish to be opened.

-Russell
 
Use the AfterUpdate event of your combo box.

My example has a combo box named cbOpenForm.

Private Sub cbOpenForm_AfterUpdate()
DoCmd.OpenForm cbOpenForm
End Sub

HTH
 
I tried that however it did not work.

The form name that has to open is different than what is displayed in the combo box.

I want the create workorder button to grab the data that says what form to open from the combo box. The form name is in column 4 of the lookup table for the 7 different workorders.
 
Try this...

Private Sub cbOpenForm_AfterUpdate()
DoCmd.OpenForm cbOpenForm.Column(3)
End Sub

Columns start with 0.

HTH
 
That did not work at all. I am not trying to have my new form open once a combo box selection is picked. I want it to be controlled by a button that is pressed and takes the value from the combo box and opens the correct form.

I am using access 2002 and my combo box is in the first tab on the form.
 
This command will open a form based on the value of the fourth column in a combo box named "cbOpenForm".

DoCmd.OpenForm cbOpenForm.Column(3)

You can add that command to the OnClick event of any button.

If that is not what you are after, please post with more details explaining exactly what you want or post a sample of your db with what you have already. I am using Access 97.

HTH
 
This command will open a form based on the value of the fourth column in a combo box named "cbOpenForm".

DoCmd.OpenForm cbOpenForm.Column(3)

You can add that command to the OnClick event of any button.

HTH

Perhaps using:

DoCmd.OpenForm Me.cbOpenForm.Column(3)

Will do the trick. It worked fine for me!
 

Users who are viewing this thread

Back
Top Bottom