Populate combo box field on button click based on list box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cluless
    New Member
    • Jul 2009
    • 4

    Populate combo box field on button click based on list box

    Hey everybody,

    I have a database with one major form that has a few subforms and a listbox, and on the form there are buttons that link to other forms as well. Once the list box is clicked on, the four subforms automatically populate based on the selection. The buttons that link to the other forms are designed to begin to add a record (based on what subform button was pressed).

    I want to find a way for the first field in the newly opened form (after a button click) to populate based on my list box selection. I'm totally 'cluless' about how to do this and would erally appreciate it if somebody could help me. Thanks!
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    Two options for this. In the Form_Open, you can save the value in an invisible box by
    1) reference the list box with Forms![MainFormName]![ListBoxName]
    2) Use the OpenArgs of the DoCmd.OpenForm, then in the new form's Form_Open(), use the predefined OpenArgs. Basically, pass the value to the newly opened form.
    Then, in On_Current(), set the field equal to the value saved in the text box.

    Comment

    Working...