Page 1 of 2 12 LastLast
Results 1 to 15 of 30
  1. #1
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272

    How to let my combo list selection appear in full in my table

    I have a table with the name : INCOME_TABLE
    with fields: FULL NAME, DATE, TYPE OF INCOME/EXPENSE,REVENUE.



    I have another table with the name :MEMBERS with fields: FIRST_NAME, LAST_NAME, GENDERS....

    I managed to create a combo on a new form which picks the first and last name displayed in the members table and the results to be displayed together in the FULL NAME field of INCOME_TABLE.

    But my issue is, when I select the drop down, both first name and last name appears in the drop down as expected but when you select one of the names, only the First name displays in the combo text box and a such, only the first name appears in the FULL NAME section of the INCOME_TABLE instead of both FIRST and LAST NAME.

    Any help on this will be greatly appreciated.

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    Your Members Table should have a MemberID Primary key field, and then you should simply store that in your income table instead of the Full_Name field.

    You can simply look up the name and display it correctly in a combo on the form used for the Income records.

    Make the combo row source =

    SELECT MemberID, FirstName & " " & LastName as DisplayName From Members

    Then hide the MemberID by setting the column width for the first column to 0
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    Am able to let is display correctly when you drop down the list. But when you select one of the names, it only displays the first name only.
    And a such, only the First name too appears in the full name section of the income table

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    PMFJI, but you should be binding the ID of the member to the income table not the actual name, whether Forename, Surname or both?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    And how do I do the binding?

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Set the bound column to the correct index.? It is on the data tab. You will need to change you income table though, to hold the foreign key and NOT the name.?

    I always have the ID field first (so 1), and always hide that as Minty suggested. You show what you like, but the ID field is stored, and then you get the other info from that when needed.

    HTH

    Edit: I can see if you follow my advice though, you will need to change your table Member as well as you do not have an autonumber ID field in there.?

    Best to get your tables setup correctly first, before playing with forms?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  7. #7
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    Am still lost with this
    Am not so much an expert with this
    Would be glad if you could break it down to my understanding

  8. #8
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    I have an auto number ID in the member table

  9. #9
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    Can you post up a stripped down version of your database? (Compact and repair it then zipp it once you have a smaller version)
    Change the names to fictitious ones, we would only need a handful of records.

    As Gasman has explained you need to get your tables set up correctly first, before messing around with forms that try and cover up a poor underlying design.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  10. #10
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    OK, that is good.

    As Minty showed (and I do it this way as I mentioned) that sql code for the combo will display First and Last name, but if you bind Column1 in the properties and that control source is IncomeTable.MemberIDFK (to indicate a foreign key from member table and not to have two names the same) then ACcess will automatically populate that with the MemberID.

    Then when you need First & Last names you would look them up from the Member table. Then if Ms Smith becomes Mrs Jones, the relationships are still intact.

    Search here and elsewhere for 'normalization'

    People post links all the time about this and it is the key to a decent functional database.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  11. #11
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    This is a sample of the database. Just an extract
    Attached Files Attached Files

  12. #12
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    Have a look at this and see what has been changed and what is being displayed and stored.
    Attached Files Attached Files
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  13. #13
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    Alright
    Let me check and get back to you

  14. #14
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    Your work didn’t actually give me what I needed. But it gave me an idea which I tried and it produced the results I needed
    Thank you Sir

  15. #15
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    As long as you aren't actually storing the full name in the Income table, doing that will lead you down a difficult path in the long run.

    Good luck with your project.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 10
    Last Post: 08-19-2018, 01:22 PM
  2. Replies: 3
    Last Post: 06-16-2018, 11:12 PM
  3. Combo box selection fills in list box
    By Mouse51180 in forum Forms
    Replies: 20
    Last Post: 03-29-2017, 06:35 AM
  4. Replies: 1
    Last Post: 03-27-2012, 07:10 AM
  5. Checking List Box Value with Combo box selection
    By empyrean in forum Programming
    Replies: 1
    Last Post: 10-23-2009, 06:01 PM

Tags for this Thread

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