How do you use a combox on single form, that will open and filter another form?

I used the attach code to do virtually the identical thing with a report.  Using a combobox to filter the results of a report, and I'm having no luck transferring the same concept to opening a form rather than a report.  The user would choose to enter data on a form, and seperate form with a single combobox would pop up anking for details, which would then filter out the main form.

Code I've been trying to use is below
Private Sub cboChooseOption_AfterUpdate()
    MsgBox Me!cboChooseOption.Column(0)
    MsgBox VarType(Me!cboChooseOption.Column(0))
    On Error GoTo Err_cmdFormApp_click:
    Dim FormName
    FormName = "frmAddDataForOptionChosen"
    DoCmd.OpenForm _
        FormName:=FormName, _
        Wherecondition:="[PK] = '" & Me!cboChooseOption.Column(0) & "'"
Exit_cmdFormApp_Click:
    Exit Sub
Err_cmdFormApp_click:
    If Err.Number = 2501 Then
    Else: MsgBox Err.Description
    End If
    Err.Clear
    GoTo Exit_cmdFormApp_Click
               
End Sub

Open in new window

Matt330Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Try this:
Ii PK is Numeric

Wherecondition:="[PK] = "  & Me.cboChooseOption.Column(0)

If PK is a String:

Wherecondition:="[PK] = "  & Chr(34) &  Me.cboChooseOption.Column(0) & Chr(34)


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Matt330Author Commented:
That was it - it was because PK was numeric.  Thanks again MX!  I'll figure out what all these single quote/ triple-double quotes  mean eventually.
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
you are welcome.  Chr(34) is a double quote ... used for clarity in posting.

mx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.