Results 1 to 9 of 9
  1. #1
    screech63 is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2022
    Location
    UK
    Posts
    10

    Contact selection


    I have three tables, tSales, tCustomers and tContacts. I have created a form that lists the Customers name and address details. I have then created a subform for entering the contacts details for managers associated with this customer. Works ok.
    I then created a Sales form from which you select the customer and it shows the company name, in the next field, I have a combo going back to the contacts but instead of showing only the contacts for the previously specified company, it shows all contacts in the contact list. How do I make it only show the associated contacts?

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    You need a Where in the combo source.
    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

  3. #3
    screech63 is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2022
    Location
    UK
    Posts
    10
    What would the Where statement be and in which combo source.
    tContacts is linked to tCustomers by CustID.

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    Either refresh the source in the afterupdate of the Customer combo with the WHERE criteria , or in the query source for the Contacts refer to the form control as criteria hardcoded. You could even use a TempVar in the query and just set that in the afterupdate event?

    As with most computer issues, several ways to skin a cat.
    Most people would start with the form option. Then if they need that query source for a combo in another form, parameterise it, either dynamically or a TempVar

    Using the form control option.
    https://docs.microsoft.com/en-us/off...-qbf-technique
    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
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,563
    In the Row Source for the Combobox for selecting a Contact you need criteria as shown below:-


    Then in the AfterUpdate of the Combobox for selecting the Customer you need to put the following:-

    Me.[NameofContactCombobox].Requery
    Attached Thumbnails Attached Thumbnails sales.JPG  
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  6. #6
    screech63 is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2022
    Location
    UK
    Posts
    10
    Thanks Mike, still struggling with it. Keep getting an error.

    What I need is someone knowledgeable in North Herts so I can sit down and go through what we require.

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    Quote Originally Posted by screech63 View Post
    Thanks Mike, still struggling with it. Keep getting an error.
    That is as much use as 'how long should my string be?'
    Report what the error is, not just the number, but the description.
    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

  8. #8
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You **could** make a copy of your dB, change the names to cartoon characters, change any sensitive data and post the dB.

  9. #9
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    Here is moke123's utility
    Randomizer
    See post #19 for a way ro randomize your data for upload


    https://www.accessforums.net/attachm...0&d=1613310673

    Micron also has one here as well.
    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

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

Similar Threads

  1. Add Contact From Outlook
    By PaulMoor in forum Macros
    Replies: 0
    Last Post: 04-19-2020, 11:23 AM
  2. Replies: 12
    Last Post: 04-16-2015, 04:44 PM
  3. Replies: 2
    Last Post: 08-22-2014, 01:20 PM
  4. Replies: 5
    Last Post: 04-09-2014, 06:57 PM
  5. last contact
    By mitchy1111 in forum Queries
    Replies: 3
    Last Post: 10-10-2009, 04:53 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