I have about 20 queries that a user would need to run, but I want to give them a more user-friendly way of running them, rather than selecting the query manually from the navigation pane. One option I've thought of is to have a combo box that lists all the queries, and when the user selects the name of the query from that list it triggers and runs that particular query.
I've seen a few examples of how to achieve similar things but something is missing and I can't quite figure out how to do it.
So far I've created a table that contains fields [QueryID], [QueryName] and [Query Description].
The Record Source for the combo box is as follows:
In the event procedure of the combo box, in the After Update property I've attempted some sort of code as follows:
where 'QueryName' would be whatever query the user selected from the combo box list.
This code obviously doesn't work, but am I along the right lines? Or should I be using a completely different approach?
Thanks
I've seen a few examples of how to achieve similar things but something is missing and I can't quite figure out how to do it.
So far I've created a table that contains fields [QueryID], [QueryName] and [Query Description].
The Record Source for the combo box is as follows:
Code:
SELECT tblQueries.QueryID, tblQueries.QueryName
FROM tblQueries
ORDER BY tblQueries.[QueryName];
In the event procedure of the combo box, in the After Update property I've attempted some sort of code as follows:
Code:
Private Sub Combo0_AfterUpdate()
DoCmd.OpenQuery =QueryName, acViewNormal, acEdit
End Sub
where 'QueryName' would be whatever query the user selected from the combo box list.
This code obviously doesn't work, but am I along the right lines? Or should I be using a completely different approach?
Thanks