Results 1 to 3 of 3
  1. #1
    Traceyann1964 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    23

    Query problem

    Hi I am still struggling with my database. I have 3 tables. Customers, Vehicles and Invoicing.


    My relationships are Customers to vehicles one to many and Customers to Invoicing one to many both linked via Customer ID. I then have a one to many relationship between vehicles and invoicing linked via vehicle reg.
    What I would like is a query to look at all invoices but for the query to show the vehicle information tied to that invoice and possibly the customer that has or had that vehicle.

    If I design a select query based on the invoicing table, it only shows invoices. If I add the vehicle table, it returns blank results. If I change the join, I get results but the vehicle fields are blank. Any ideas as to what I am doing wrong?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    tCustomers.custID -->tInvoices.custID--> tVeh.custID

    use an outer join in case not all invoices have a vehicle.

  3. #3
    Traceyann1964 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    23
    Hi Thanks for the reply. That worked thank you. I do have another question. In a scenario where a customer changes their vehicle, I have a field in the vehicles table called "inactive" and tick the box to say yes that is a previous vehicle. I then enter a new vehicle for that customer. If I then raise an invoice (through a form) for the "new" vehicle, and go back into the invoicing table, the invoice for the "inactive" vehicle is showing with the new vehicle details ie Car registration plate when it should be against the "inactive" vehicle. Sorry if that sounds complicated

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

Similar Threads

  1. Update Query Problem (Not an Updateable Query)
    By McArthurGDM in forum Queries
    Replies: 6
    Last Post: 02-19-2015, 11:25 AM
  2. Problem with a query
    By data808 in forum Access
    Replies: 6
    Last Post: 06-07-2014, 12:31 AM
  3. Query problem
    By puppychew in forum Access
    Replies: 20
    Last Post: 02-01-2010, 09:43 AM
  4. query problem i have a problem wi
    By maxx3 in forum Queries
    Replies: 0
    Last Post: 06-29-2009, 02:29 AM
  5. query problem
    By maxx3 in forum Queries
    Replies: 35
    Last Post: 05-29-2009, 04:07 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