469,922 Members | 2,106 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,922 developers. It's quick & easy.

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

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
1 2289
NeoPa
32,232 Expert Mod 16PB
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.

Similar topics

By using this site, you agree to our Privacy Policy and Terms of Use.