Results 1 to 6 of 6

Thread: Auto populate

  1. #1
    Join Date
    Feb 2014
    Posts
    9

    Unanswered: Auto populate

    I have a table with 3 fields

    Family
    Description
    Area


    What I want my form to do is......... When I select that description, it auto populates family and area for me...... then save this information in another table.

    Thanks in advance
    Attached Thumbnails Attached Thumbnails Capture.GIF  

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Add the three values in the query that's used for the RowSource of the combo and set the ColumnCount of the combo to 3. You can then address the value in each column of the selected row with the syntax:
    Code:
    Value = Combo.Column(x)
    Where x is the index of the column, knowing that the first (leftmost) column is Column(0).
    Have a nice day!

  3. #3
    Join Date
    Feb 2014
    Posts
    9
    Thanks for the reply, I am not familiar with VBA. Can you tell me which property to change in the form?

    Thanks

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Here (change the names used here by the actual names in your project):
    Code:
    Private Sub Form_Open(Cancel As Integer)
    
        With Me.ComboName
            .ColumnCount = 3
            .ColumnWidth = "2200;0;0"    ' Adjust to your needs.
            .RowSource = "SELECT Description, Family, Area FROM TableName;"
            .AfterUpdate = "[Event Procedure]"
        End With
    
    End Sub
    
    Private Sub ComboName_AfterUpdate()
    
        Me.Text_Family.Value = Me.ComboName.Column(1)
        Me.Text_Area.Value = Me.ComboName.Column(2)
    
    End Sub
    Have a nice day!

  5. #5
    Join Date
    Feb 2014
    Posts
    9

    auto populate

    Thanks for your help on this

  6. #6
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!
    Have a nice day!

Posting Permissions

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