Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What's wrong with this filter code?

Status
Not open for further replies.

miltie

Technical User
Nov 4, 2002
15
US
Hello all,

I have a combo box called cboOSC on a form frm94. The combo box is populated by a subform. I want to dblclick on cboOSC to bring up another form called frmOSC. The frmOSC needs to be filtered by the value in cboOSC. When frmOSC pops up, it asks to input a parameter value. In the parameter value box, my cboOSC value is listed above the blank text box. If I put in the value that is currently in the cboBox, it works fine. I don't want to have to input any value. The code I'm using is:

Private Sub cboOSC_DblClick(Cancel As Integer)
On Error GoTo cboOSC_DblClick

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmOSC"

stLinkCriteria = "[OSC] = " & Forms![frm94]![cboOSC]

DoCmd.OpenForm stDocName, , , stLinkCriteria

DoCmd.RunCommand acCmdApplyFilterSort

Exit_cboOSC_DblClick:
Exit Sub

cboOSC_DblClick:
MsgBox Err.Description
Resume Exit_cboOSC_DblClick

End Sub

Please let me know if there is anything obvious I'm missing.

Mike

 
In frmOSC recordsource query add this to criteria: Forms!frm94!cboOSC .
 
I put that code in the query. It's still prompting for parameters. Any other suggestions?

Thanks,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top