Combo Box selection limited by value in text box

G

Guest

I want a combo box on my form to select an appointment within a date range
that I enter into text boxes txtDateHigh and txtDateLow on my form. The combo
box row source is like:

SELECT Patient, ApptDate, ApptTime WHERE ApptDate Between [txtDateLow] And
[txtDateHigh];

Problem is, when I change the dates in txtDateHigh and txtDateLow, the combo
box selection does not refresh. The selected range stays as it was. Is there
a better method for this? Thank you.
 
T

tina

you need to "re-run" the combo box's RowSource query to apply the new date
parameters. in the AfterUpdate events of txtDateHigh and txtDateLow, add the
following code, as

Me!ComboBoxName.Requery

or, instead, you could add the code to the combobox's Enter event.

hth
 
G

Guest

Thank you tina. I had actually tried doing a Requery on the ENTER or CLICK
events of the combo box, and it didn't work. However, using what you
suggested on the After Update events of txtDateHigh and txtDateLow did the
job. Thanks again...

tina said:
you need to "re-run" the combo box's RowSource query to apply the new date
parameters. in the AfterUpdate events of txtDateHigh and txtDateLow, add the
following code, as

Me!ComboBoxName.Requery

or, instead, you could add the code to the combobox's Enter event.

hth


richardb said:
I want a combo box on my form to select an appointment within a date range
that I enter into text boxes txtDateHigh and txtDateLow on my form. The combo
box row source is like:

SELECT Patient, ApptDate, ApptTime WHERE ApptDate Between [txtDateLow] And
[txtDateHigh];

Problem is, when I change the dates in txtDateHigh and txtDateLow, the combo
box selection does not refresh. The selected range stays as it was. Is there
a better method for this? Thank you.
 

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