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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter Query prompted by combo box click 1

Status
Not open for further replies.

bikerted

Technical User
Nov 7, 2003
221
GB
I have attempted to use code from faq181-120 without success. Before explaining what I've done, this is what I want to achieve: 1). Select a parameter from a list in combo box on my form. 2). Click on the selection. 3). Open the parameter query - without the usual pop up dialog box - and 4). Run the query DIRECTLY from the selection with no intervening steps. Just click to reveal the list and click to select and open - nothing else! The code in my parameter query reads: [Forms]![my form name]![cboCombo115]. In the ON CLICK event of the combo box I have the following, which I know probably needs error handling:

Private Sub Combo115_Click()
On Error GoTo Err_Award_Parameter_Query_Click

Dim stDocName As String

stDocName = "TESTparameterquery"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Award_Parameter_Query_Click:
Exit Sub

Err_Award_Parameter_Query_Click:
MsgBox Err.Description
Resume Exit_Award_Parameter_Query_Click
End Sub

Bearing mind (please) that I am a complete novice with code, can you explain hoew to get this right? I would be most grateful for any assistance.

Thank you, Ted.
 
Private Sub Combo115_Click()
[Forms]![my form name]![[highlight]cbo[/highlight]Combo115]
???

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks for your speedy reply PHV. I'm still in the dark here. The sub-routine seems to be mixed up with the SQL - or am I being even more thick than usual?! I need to confirm that the combo box on-click code is right and that the criteria expression in my parameter query is correct too. If you don't mind taking a look at the faq, maybe you'll see where I am fault.

Ted.
 
What is the control name of the combo (Combo115 or cboCombo115) ?
If the query is launched when you click the combo and if your post has no typo, then put the right combo name in your query parameter.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Absolutely SPOT ON!!!

A thousand thanks - It seems I take some of the example codes too literally!

Thank you

Ted
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top