Use Listbox value to open specific form

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

CFP - Russell

Guest
Hello everyone, I would like to use a listbox to open different forms based on the value of a specific field in the listbox.
 
DoCmd.OpenForm "myForm", , , "myID = " & Me.myListBox
 
Thanks but i have 4 different forms I want the same listbox to be able to open.
 
You can still use Mile's code.

The only thing you have to do different is specifiy which column you want to compare data to.

DoCmd.OpenForm "MyForm",,,"mid =" & Forms!ListForm!lstBox.Column(0)
DoCmd.OpenForm "MyForm2",,,"location =" & Forms!ListForm!lstBox.Column(1)

And so on.....

Hope this helps.
 
Thanks but I dont need to open more than one form at once. What I need is to have the correct form open based on the value in the listbox.

So the form name that opens is going to vary based on the workorder type.

The listbox shows all the workorders and
If the workorder is a fire suppression workorder I want the fire suppression workorder form to open.

I hope this is a little more clear.

Thanks,
Russell
 
I realize that. Doesn't mean you have to open many forms at once.

just use an if statement with the colum reference like before.

Set the if statement to check for different values and these values open different forms.
 
Last edited:
Your structure sounds suspect, why do have different forms dependant on type?
 

Users who are viewing this thread

Back
Top Bottom