Using combobox - display in subform

S

SpookiePower

I have a mainform with a subform on. On my mainform
I also have a combobox containing names of the 12 months.

When I choose a month in the combobox I want all the
customers from that month to be displayed in the subform,
but I dont know how to do this.

I have made this SQL

SELECT *
FROM customer
WHERE (((customer.month)=Forms!kunder!combomonth));

that select the customers by months.

But I don't know how to use this SQL to find customers by selecting
a month in the combobox, and then shows them in a subform.

Anyone who can help me ?
 
A

Allan Murphy

Put the SQL as the record source for your sub-form

Then on the After Update event of your combo box add the following

DoCmd.Requery "subform" where subform is the name of your sub form.
 
S

SpookiePower

I can't get i to work.

First - I can't find any record source on my subform, only a
sorce object, but I don't know if thats the same.

Second - After I have put DoCmd.Requery Subform, into my
combobox, I get this message when I use the combobox :

"Microsoft access can find the macro DoCmd. The Macro or
its macro-group doesn't exist, or the macro is new and haven't
been saved. Note that when you enter the
macrogroupname.macroname syntax in the argument, you must
specify the name the macro's macro group last was saved under."

I'm not sure what all this means.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top