Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combobox refresh for each new record ?

Status
Not open for further replies.

DahMurf

Programmer
Apr 12, 2003
44
US
I have a form with fields and a combobox based on two tables.

The fields I'm working with from tbl_impound that are displayed on form frm_impound:
Vehicle Date Time Class

I also have a table tbl_class_op with fields
Vehicle
Date
Time
Class

On form frm_impound I have a combo box for the field class with the data selected as

Code:
SELECT DISTINCT tbl_class_op.Class, tbl_class_op.Vehicle FROM tbl_class_op where vehicle =
forms![frm_impound]![vehicle];

When I open the form the first record's combo box filters correctly. When I page to the next record I wanted the combo box to updated based on the new vehicle being displayed but it's still showing the class for the first vehicle.

Example:
tbl_class_op
Vehicle Date Time Class
1 1/1 10:00 A
1 1/1 10:10 B
1 1/1 10:20 C
2 1/1 10:00 D
2 1/1 10:10 E
2 1/1 10:20 E
2 1/1 10:30 D

This is what I want:
frm_impound:
Vehicle Date Time Class Combo choices
1 1/1 10:05 A, B, C

1 1/1 10:40 A, B, C

2 1/1 10:10 D, E

What I'm getting:
frm_impound:
Vehicle Date Time Class Combo choices should be
1 1/1 10:05 A, B, C

1 1/1 10:40 A, B, C

2 1/1 10:10 A, B, C

Can someone tell me how to fix this? Also, can I do this on a continious form?

Thanks in advance!
Debbie [ponytails2]



 
In the Current event procedure of frm_impound call the Requery method of the combo.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I've added to the frm_impound on On Current Event

Code:
     Me!combo_class.Requery

It works perfectly even in continious form!
Thanks a bunch!
Debbie [ponytails2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top