Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Des Moines, Iowa
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Auto-Populating Form Controls

    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?

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto-Populating Form Controls

    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:<pre>Private Sub cboFieldNames_Change()
    txtChangingField.ControlSource = cboFieldList.Value
    txtChangingField.Requery
    End Sub</pre>

    That should do the trick. Now, as for why you want to do this.... <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    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 <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>

Posting Permissions

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