• Auto-Populating Form Controls

    Author
    Topic
    #355390

    I have a database with one table and one form. I also have a combo box on the form. I want to be able to select one item from the dropdown list and have a text box automagically populate with a different field.

    This seems like such a common task, but the solution eludes me. Anyone know a simple answer to this?

    Viewing 0 reply threads
    Author
    Replies
    • #524011

      Assuming I understood your request, here’s a way to solve your problem: Bind the form to the desired record source. Set the ComboBox RowSourceType to FieldList. Set the RowSource property to the desired data source (the same one the form is bound to). On the OnChange event of the Combo Box, insert the following code:

      Private Sub cboFieldNames_Change()
           txtChangingField.ControlSource = cboFieldList.Value
           txtChangingField.Requery
      End Sub

      That should do the trick. Now, as for why you want to do this…. shrug
      It honestly doesn’t sound like a very efficient technique. Maybe you could post more information about what you’re trying to achieve and we can work on a more efficient solution.

      HTH thumbup

    Viewing 0 reply threads
    Reply To: Reply #524011 in Auto-Populating Form Controls

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel