Combo Box selection limited by value in text box

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
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.
 
Back
Top