Run a report or a query

timbits35

Registered User.
Local time
Today, 14:42
Joined
Nov 3, 2011
Messages
33
Hi,

I have a combo box with a list of queries that I can choose and then run the query. I just have some simple code :

Private Sub cbochoose_AfterUpdate()
DoCmd.OpenQuery Me.cbochoose
End Sub

But now I want to add the possibility of reports as well. So I would need some code to say that if it is a query run the query and if it is a report run the report.

My query names all start with qry and my report names all start with rpt.

Thank you for any help.
 
I personally would never let users into a query directly, only forms or reports. That said, you can use the Left() function to test the selection and react accordingly (If/Then block).
 

Users who are viewing this thread

Back
Top Bottom