Open form with record from combo box

moleary

Senior Member
Local time
Today, 18:23
Joined
Feb 9, 2001
Messages
58
I am trying to get a form to open up to a record that I have pulled down from a combo box and the code that I used is not working can someone help!!

DoCmd.OpenForm "intakeall",,,"key = '" & Me!combo11 & "'"
 
If Key is a number then try this:

DoCmd.OpenForm "intakeall",,,"[key] = " & Me!combo11
 
I tried that and it did not work! any other suggestions???
 
Is 'Key' the bound column in the Combo box? If not then you need to need to change your code to something like:

DoCmd.OpenForm "intakeall",,,"[key] = " & Me!combo11.Column(x)

Where x is the column that has the 'Key' value you in it and remember that Combo boxes are 0 (zero) based so the first column is 0 not 1
 
Does anyone have any other suggestions how how I could get this to work??

Thanks
 
Is the form already open and you just want to populate it with the record, or do you want another form to open with the record?
 
Well I want to be able to pull up a name from the combo box and then it pull up that record on the form, the form is not already open they would pick which form they want to open for that particular person.
 
The code I gave you earlier is what you want (DoCmd.OpenForm "intakeall",,,"[key] = " & Me!combo11) but now you will have to have a variable for the Formname as you want the user to select the form as well. Assign the form selected by the user to a variable and use that in place of "intakeall".
 

Users who are viewing this thread

Back
Top Bottom