Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2004
    Posts
    173

    Unanswered: Combo Box Problem

    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.

    Anybody ever run into this problem??

  2. #2
    Join Date
    Feb 2004
    Location
    CT,USA
    Posts
    250
    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?

  3. #3
    Join Date
    Apr 2004
    Posts
    173

    combo box problem

    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.

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    This sounds like a problem with value vs. text. Try adding this line of code to whatever you are using to populate the combo box:

    me.yourCombo.Text = me.yourCombo.Column(0,0)
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  5. #5
    Join Date
    Feb 2004
    Location
    CT,USA
    Posts
    250
    Teddy,
    You jog my memory of the combo parameter/setting something like "bound to column" whether the combo points to the index or text. Is that what your statement does-- set the text to ______?

  6. #6
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    That statement sets the text property equal to the first entry in the first column of the text box.

    When you set the rowsource for a combobox, it will not necessarily display anything in the text property.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •