I'm working on a fleet mngmt tool for my company and I have the following problem. I have a vehicle set up form that asks for the input from the user about the vehicle. On this form I have a button that opens a modal form that sets a relationship between a given vehicle and a given route. When the modal form loads it uses information from the first form to populate a combo box with the available routes for the vehicle's previously assigned branch and division. I open the modal form from a module so I can use it from different forms; this all works great but when I've got the vehicle assigned to a route the route does not show up in the combo box until I click in it. There is no click event defined for the control. I'm setting that combo box's row source from the module based on vals passed in. I've tried the following.
combo boxes requery event in the on load and on current
forms recalc and requery event in the on load and on current
combo box set focus to another control and return focus to the combo box
none of these has worked and frankly it's driving me nuts.
Hmmm, good prep work and trials. But I have q's. "I open the modal form from a module so I can use it from different forms"... Does that mean you have a Public Sub Procedure to open your modal form?
My thinking (w/ very limited data) is that your combo box gets focus & can display what happens in the module. I guess (what a SWAG) that you probably need a Public Sub routine that can be called from the On Load command of the form/cmbo box. Which sounds similar to your failed attempts. Perhaps there is a better event trigger.
From Access help, section "Order of events for controls on forms"
The following sequence of events occurs for each key you press in a text box or in the text box portion of a combo box:
KeyDown Þ KeyPress Þ Change Þ KeyUp
These sound like fair game.
"but when I've got the vehicle assigned to a route"... Does this mean when there is no route assigned it's ok too?
thanks for the reply, I have a button on the main form that calls a public (module) level subroutine. That subroutine opens the form with filter expression to limit the modal forms records to only those that pertain to the current vehicle on the other form. If the current vehicle on the main form is not assigned to a route the combo box in question loads with nothing in it (which is good because no route has been assigned). If the current vehicle on the main form has been assigned to a route, the modal form should load with that route's number in the combo box in question. The value property of the combo box is in deed set to the right value the only problem is that value does not display in the box unitl I click in that box. There in lies the rub. I can't seem to get that value to show up until i click it.