Results 1 to 3 of 3
  1. #1
    Waddell is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1

    Question Look-up Field Query to only show AddressIDs with matching CompanyIDs [SEE SCREENSHOTS]

    Hi,



    I am designing a job management system for my company, logistical business, where we will be able to; store all customer & company details; look-up company contact information; input job information.

    I have been able to get the company details, addresses and contact to work fine, however I have encountered an issue within the 'Transport Booking' part of the database which I need help with!

    There are 5 main tables in the DB as follows: Companies, Company Addresses, Company Contacts, Shipment Tracker and Transport Tracker [See Relationships Screenshot].Click image for larger version. 

Name:	Relationships.jpg 
Views:	13 
Size:	108.8 KB 
ID:	33943

    Within the 'Companies' table, I have put 3 Yes/No fields, 'Customer', 'Pick-up Point', 'Delivery Point' and have ticked where appropriate to tell the DB whether the company is a customer, pick-up/delivery point, or a mixture of all three.

    I have used this to create a query, which I have used in the 'Shipment Tracker' and 'Transport Tracker' to create a Look-up field for CustomerID (Shipment Tracker) and Pick-up and Delivery CompanyID fields (Transport Tracker) which have worked quite well [See Shipment Tracker & Transport Tracker Screenshots] Click image for larger version. 

Name:	Shipment Tracker.jpg 
Views:	12 
Size:	125.0 KB 
ID:	33944Click image for larger version. 

Name:	Transport Tracker.jpg 
Views:	12 
Size:	129.0 KB 
ID:	33947

    The issue I am now having is in the Transport tracker, namely the PickupAddressID & DeliveryAddressID [the two fields after the Look-up fields I have mentioned earlier]. I only want them to show the AddressIDs of the company selected in the 'PickupCompanyID' & 'DeliveryCompanyID' which are both foreign keys of the CompanyID on the 'Companies' table. Also, the CompanyID on the 'Company Addresses' is a foreign key of the CompanyID primary key.

    This is an issue due to the fact that some of the companies have more than one address, dnata having as many as eight, so for example, when we select dnata as the PickupCompanyID, we only want the eight dnata addresses to be shown in a Look-up field to be selected.Click image for larger version. 

Name:	Company Addresses.jpg 
Views:	12 
Size:	257.9 KB 
ID:	33945Click image for larger version. 

Name:	Companies.jpg 
Views:	11 
Size:	163.4 KB 
ID:	33946

    Any help in the right direction on this would be great!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    This is called cascading (or dependent) combobox (or listbox). A very common topic.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Trying to follow what you are trying to do... and I see two problems (IMHO):

    1) You have spaces in object names: fields, tables, queries and forms.

    Use only letters and numbers (exception is the underscore) for object names.
    Do not use spaces, punctuation or special characters in object names.
    Do not use Look up FIELDS, multi-value fields or calculated fields in tables.
    Do not begin object names with a number.

    2) It sounds like you have LOOK UP FIELDS (in tables). Not a good idea. Most experiences Access programmers do not use LOOK UP FIELDS.
    Note: Look up tables are different (OK).


    You might want to see:
    The Ten Commandments of Access
    The Evils of Lookup Fields in Tables

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

Similar Threads

  1. Look Up - show fewer options by matching criteria....?
    By synses in forum Database Design
    Replies: 3
    Last Post: 03-13-2017, 02:33 PM
  2. Replies: 3
    Last Post: 07-20-2014, 08:56 PM
  3. Replies: 4
    Last Post: 04-24-2013, 02:11 PM
  4. Replies: 1
    Last Post: 10-24-2011, 08:01 AM
  5. Replies: 1
    Last Post: 08-11-2011, 11:33 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