By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,493 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,493 IT Pros & Developers. It's quick & easy.

Populating a subform based on the query selected on the combo box

P: 1
I have a combo box with list all the queries I have on my database:

Form is called: frm_qry_slct

Combo box (Unbound): Combo23

RowSourceType: Table/Query
RowSoource:SELECT [Name] FROM MSysObjects WHERE [Type]=5 And [Name] Like "qry_#*" ORDER BY [Name];

Then my SubForm

I have a command button on the form just below the sub form to extract the query result into excel with the following code:

DoCmd.OpenQuery "Name of my query", acViewNormal
RunCommand acCmdOutputToExcel

How do I populate the subform based on the query selected on the combo box?

Thanks in advance, not really confident in vba, all the codings I know are taken from forums.

Thanks in advance

D
Oct 21 '08 #1
Share this Question
Share on Google+
1 Reply


NeoPa
Expert Mod 15k+
P: 31,186
You set the form's Record Source property to point to the query you want displayed (You may want to check out Referring to Items on a Sub-Form).
Oct 22 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.