refresh combo boxes on form

B

bpauley

How do I refresh combo boxes on a form?
I have two combo boxes dependant on the info in 3 other combo boxes. the two
I need refreshed are cboCurrPayRate and cboCurrPayRate. All works exactly as
planned, except when I change records by scrolling or by using the record
change arrow, the rates behind the two combo boxes do not update based on
the current info in the other 3 combo boxes. When I refresh the form the
rates behind the combo boxes update as desired.
I have tried refreshing the form on the "onchange" event, but no good.
Me!frmEnterMonthlyVisits.refresh
is the line I used.
Thanks
Bill
 
S

Sandy Hayman

Hi Bill
In the after_update event of the combo box, use the following line (replace
combobox with your combobox name):

me.combobox.requery

Sandy

AA Absolute Access, ACT - Australia
 
B

bpauley

Hello Sandy,
Thanks for your response
I tried your suggestion, but I get the same result. I am probably not
explaining my situation very well.
When I enter a new record it works at expected. When I go to a different
record, after entering a new record or opening the form, the rates in the
combo boxes don't synchronize with the change in the first 3 combo boxes. I
will try to explain what I have.
I enter a contactid in the first combobox to select the employee and type
(PT OT ST PTA COTA). The second combo box selects the facility the employee
is working in. The third combo box selects the type of shift the employee is
working. So those three combo boxes filter a query down to the exact rate to
pay and bill for the employee hours. The two combo boxes that I am trying to
synchronize are cboCurrRateAmt and cboCurrPayRateAmt. Both display a
currency amount. In the query design grid behind the form, I have in the
criteria of the ContactID, forms!frmEnterMonthlyVisits.ContactID; in the
FacilityID, forms!EnterMonthlyVisits.FacilityID; in the TherID,
forms!frmEnterMonthlyVisits.TherID.
As I said, all works well until I move to a different record. The
CurrRateAmt and CurrPayRateAmt combo boxes do not update to the new amounts
unless I requery the form.
Hoping you can make some sense of what I have tried to explain.
Thanks again for your suggestion. Any other ideas?
Bill
 
T

tina

try requerying the two dependent combobox controls on the *form's* Current
event, as

Private Sub Form_Current()

Me!cboCurrRateAmt.Requery
Me!cboCurrPayRateAmt.Requery

End Sub

hth
 
B

bpauley

Hello Tina,
I did as you suggested and also cleaned out some of the old code from past
attempts to get this to work and wallah! it is working.
Big Thanks to you and Sandy for your suggestions.
Bill
 
T

tina

you're welcome :)


bpauley said:
Hello Tina,
I did as you suggested and also cleaned out some of the old code from past
attempts to get this to work and wallah! it is working.
Big Thanks to you and Sandy for your suggestions.
Bill
 
S

SharynInCambodia

Hello, not sure if anyone is still looking at this but just trying to solve
my problem here!
I have a very similar problem but had already worked out the requery code
and i thought all was fine. But later relooked at it and another problem
came up. my combo boxes are based on a lookup table which displays a name
but stores the primary key ID. if i enter in one record - all is fine. a
second record - it looks fine. but when i go back to the first record, the
displayed names of the dependent combo boxes are showing names from the query
in the latter record. the IDs stored are correct but the names are wrong. If
i display the IDs then it would be OK, but I want the names displayed as the
IDs are not helpful to look at (they are place names vs ID numbers).
Any help much appreciated!
 

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