How to refresh a combo box without closing a program?

G

Guest

Hi,

In my form I've two combo box, the first one have it's rowsource connected
to a query (As usual ... this one work properly).

My problem is with the second one. This combo box also have it's row source
connected to a query BUT the results of the query are limited by the result
of the first query. (Meaning If my first combo box let me chose a department
the second one will give me all employee that work for that department.)

Now ... the first time I run the program I chose my dept from the first
combo box and then I could chose an employee that work in the preselected
department. Ok this WILL work but if I now chose to click on the first combo
box to chose another dept. I will still have the employee from my previous
query AND I should have the one for my new query. So on the first run
everything works but after that the second combo box refuse to show the good
result. I do know that the underlaying query works cause I've check the
result and they are correct. My problem is that the combo refuse to show the
new result.

So my question really is ... What can I do to force the second combo box to
requery and also to refresh itself ?

I do know it's possible to do so cause many years ago (when I was
programming in Access more often) I've done that stunt ... but now I can't
remember how ...


Many thanks for your help

Stephane Pelletier
 
N

Nikos Yannacopoulos

Stephane,

You need to put a line of code like:

Me.cboEmployee.Requery

in the On Change event of the department combo (I assumed the name of
the employee combo to be cboEmployee, change to the atual name).

HTH,
Nikos
 
G

Guest

Thanks Nikos,

I've tried it but it still dont work ... I've tried to put that line in
different place and it's still no go. I've look in my query and the result
that the combo box should show are there but ...


Any other Idea ?

Stéphane
"Nikos Yannacopoulos" a écrit :
 

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