Results 1 to 9 of 9
  1. #1
    Sadsfan is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2020
    Posts
    5

    Inserting fields from a record when a selection is made in a ComboBox

    I am a beginner using Access. And I am creating a database to log telephone calls. I have two tables, one called 'Families' and another one called 'Call Records'


    'Families' has the following fields:

    • 'Family'
    • 'Children
    • 'Status Code 1'
    • 'Status Code 2'
    • 'Status Code 3'

    I have created a form in 'Call Records', I have added a ComboBox that lists the family names from the 'family' field in the 'Families' table.
    What I would like is, that, when they select a name, it populates other text boxes with the other fields for that record from the 'families' table. Is it possible to do that?
    I am using Access 2016.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Include all the required fields in the Row Source property of the combo box using a predefined query or an SQL Select statement.

    Adjust the Column Count property to include all the required fields and the Column Widths properties for each column.

    Set the Control Source property of a text box to = NameOfComboBox.Column(1)
    The figure in brackets refers to which column you want the data from. First column is (0), second is (1) etc.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Sadsfan is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2020
    Posts
    5
    Thanks Bob, I will have a try at that, I'm a beginner, so some of that sounds complex to me, but I will have a go at figuring it out!

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Quote Originally Posted by Sadsfan View Post
    Thanks Bob, I will have a try at that, I'm a beginner, so some of that sounds complex to me, but I will have a go at figuring it out!
    Good Luck
    Let us know if you need any further help.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    Sadsfan is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2020
    Posts
    5
    Thanks Bob, the first part was fairly simple, I created the query and then added that to the row source property.

    When I go to the property of a text box I have typed in what you said, and it changes it to this:
    Click image for larger version. 

Name:	Combo.png 
Views:	7 
Size:	13.5 KB 
ID:	41706
    and then nothing appears in the text box when I select a family name from the combo box.

    Thanks

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Did you:
    Adjust the Column Count property to include all the required fields and the Column Widths properties for each column.

    I've attached a very basic example for you to look at:
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  7. #7
    Sadsfan is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2020
    Posts
    5
    Thanks Bob, that worked a treat. Last question... How do I get the form to write that information to my call record table? By that I mean the information that has been copied into the text boxes.

    Maybe I should be a bit clearer on this.
    I want the form for call record table to get some of the information from the families table (so people don't have to type out all of the information, e.g. surname, forename etc)

    The form will have additional boxes to fill in e.g. date called, message left, conversation had

    And then all this information on the form to be added to the call record table

  8. #8
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Sadsfan
    How do I get the form to write that information to my call record table? By that I mean the information that has been copied into the text boxes.
    You don't.
    In a relational database you don't duplicate data from one table to another. You have relationships between tables. Mostly these are one to many. For example: One customer has many orders. Each order has many items.
    I would strongly advise you to read a little on the subject of relational database design.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  9. #9
    Sadsfan is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2020
    Posts
    5
    Thanks Bob, I will do some reading. Thanks for your time.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. How to update record with combobox selection
    By vector39 in forum Programming
    Replies: 3
    Last Post: 09-25-2017, 09:19 AM
  2. Replies: 4
    Last Post: 09-13-2017, 10:35 AM
  3. Replies: 2
    Last Post: 11-26-2016, 05:43 PM
  4. Replies: 3
    Last Post: 11-25-2013, 08:23 PM
  5. Replies: 1
    Last Post: 06-20-2013, 10:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums