Results 1 to 10 of 10
  1. #1
    Tom Evans is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2023
    Posts
    7

    Using a Combo Box to place 2 fields simultaneously.

    I have 2 tables (“Liquor” and “Transactions”).
    The table “Liquor” has 2 fields namely “TypeLiquor” and “Cost”.
    The table “Transactions” has 2 fields (namely “Liquor” and “Price”).
    Using a Combo Box on a Form I wish to search table “Liquor” and put BOTH the “TypeLiquor” and the “Cost” into the fields “Liquor” and “Price” in the Table "Transactions".


    I am having problems placing both fields simultaneously.
    Last edited by Tom Evans; 07-03-2023 at 10:35 PM.

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The second option may be appropriate for you:

    http://www.baldyweb.com/Autofill.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Don't you mean 'fields “Liquor” and “Price” in the Table "Transactions".
    Whilst the cost may change, is the Type going to? That would be the only reason I can see for storing the same data twice, bit like an order item line.?
    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

  4. #4
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Hi Tom
    How are your 2 tables related? What is the Autonumber PrimaryField name in table "Liquor"
    What is the related ForeignKey name is table "Transactions"
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  5. #5
    Tom Evans is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2023
    Posts
    7
    Quote Originally Posted by Welshgasman View Post
    Don't you mean 'fields “Liquor” and “Price” in the Table "Transactions".
    Whilst the cost may change, is the Type going to? That would be the only reason I can see for storing the same data twice, bit like an order item line.?
    My error. You are correct - it should be table "Transactions".

  6. #6
    Tom Evans is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2023
    Posts
    7
    Hi Mike. There are other tables and fields in the database. Relationships and Foreign Key Constraints seem to be correct but may need some fine tuning as development progresses.

  7. #7
    Tom Evans is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2023
    Posts
    7
    Thanks Paul. I will try your options later today. I will update you.

  8. #8
    Tom Evans is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2023
    Posts
    7
    This has solved my problem.
    Much appreciated.

  9. #9
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Hi Tom

    I would suggest that your table "Liquor” should also have a PK Autonumber of LiquorID

    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  10. #10
    Tom Evans is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2023
    Posts
    7
    Thanks Mike. Done already. Will get back to you if I have any further problems.
    Cheers

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

Similar Threads

  1. Replies: 3
    Last Post: 12-14-2021, 11:08 AM
  2. VBA to run two module or sub simultaneously.
    By johnseito in forum Programming
    Replies: 4
    Last Post: 07-18-2018, 01:49 AM
  3. Replies: 11
    Last Post: 01-19-2015, 05:40 AM
  4. Replies: 3
    Last Post: 05-27-2014, 09:31 AM
  5. Replies: 4
    Last Post: 07-13-2012, 12:47 PM

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