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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Updating 2nd Combo Box Based on Value in 1st Combo Box

Status
Not open for further replies.

fbueller

Programmer
Sep 6, 2006
9
US
I’m close, but I’m stuck in my attempt to update certain controls on a form according to choices made in other combo boxes. I am working on a program which records weights for shipments. Here’s what I have so far.

I have a table named CONTAINERS which lists available cars by type(trains, trucks and forklifts). The first selection a user makes when opening the form is what type of vehicle is being used(Railcar, Truck or Forklift).

Based on this choice, I set the rowsource of the first combo box(cboCarId) to a query listing the available vehicle IDs for that type.

Here is where I get into trouble. Two weights are entered to make a complete record(Full and Empty). I have a table named SCALE_READINGS listing all scale readings recorded. When matching Full and Empty weights are recorded, I mark both records as complete.

If a user selects a value in cboCarId for which only 1 weight has already been recorded(an incomplete record), I want to list the previous entries recorded(ex: Weight Type, Scale Weight, Time of Weight) in a series of text boxes. I have a query that takes the CarId and pulls any incomplete records for that car. When run directly and I enter the CarId value directly, the query works great!

But I can’t seem to tie the query results to form controls. I created a second combo box(cboPreviousWeight) whose Row Source is set to the working query. I set the criteria for CarId in the query equal to the value of the first combo box(N'Forms!frm_scale_house!cboCarId').

After the user makes a selection in the first cboCarId box, I have an AfterUpdate event which requeries the second cboPreviousWeight box. It works halfway, because I can hit the drop-down menu on the second combo box and see the same cars as the first combo box. But so far, I have not been able to make the second combo box run and be populated with the target car I want.

Can anyone point me in the right direction? I have been working on this for several hours now!!
 
Please post the SQL for the second combobox.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top