Results 1 to 7 of 7
  1. #1
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476

    How to create this Query?

    I have 2-Tables – a CUSTOMERS Table which lists ALL of my customer’s info with a CustomerID. My second table is my VEHICLES tables which contains ALL of the Vehicles info. I’m able to create/run a query which shows how many vehicles per customer. However, those customers who haven’t purchased a vehicle yet how do I see them also? In other words, I need a query which shows me ALL of my customers, those who have brought & have yet to purchase a vehicle. With this such query I can (my objective) is to create a Combo Box that displays the CustomersID & the number of vehicles purchased (including the customers who have “0” vehicles). I hope to have explain my objective clearly

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    In design view, right click or double click on the join line to edit it. The correct selection should be obvious at that point.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    kwolfel is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Posts
    15
    Like pbaldy states, you want to right click and choose join properties. From there, you have the option to choose all records in the customer table and only those from the vehicle tables where the tables are equal. This will pull in all records from the customer table like you want.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    I must not have stated it well enough?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    kwolfel is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Posts
    15
    I'm sorry - I didn't mean to offend. I just know when I'm searching for an answer it always helps when the answers are specific, especially if you're just starting out and aren't familiar with joining tables. I just figured it might help to add a little extra detail.

  6. #6
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476
    Yes, I thought to have acknowledge & thanked pbaldy for his suggestion which worked welln. As well, thank you for following up :-)

    kwolfel:
    Do you know what is the magic portion in getting your Combo Box to Requery after making a selection in a Record? Ling, (no offense) told me to go on the Event Tab & in the On Current type the code, “Me.Combo25.Requery” (the Combo Box name is Combo25). I have no reason to doubt Ling’s knowledge, yet it’s not working for me. Or, maybe I’m not clear on my objective. When I add a CustomerID to a Vehicle (on a Form) within my CustomerID Combo Box tells me how many vehicles a customer purchased (even those customers who have yet to purchase “A” vehicle) So, when I click on a customer & I go to another Record the number of vehicles should change after the last inputted customer in my Combo Box, but it doesn’t. Yes, I could hit Refresh ALL which will Requery my Combo Box, but by hitting Refresh ALL puts me back to the first Record. Might you have any insight?

  7. #7
    kwolfel is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Posts
    15
    djclntn,

    I normally would use "AfterUpdate" to requery. On the CustomerID Combo Box, go to the event tab and create an event [press the ... button] at the AfterUpdate. In code, you want to requery your Vehicle combo box similar to what you have done above. This will update your vehicle combo box always after the customer combo box is updated. It should look something like below (you'll only need to add the requery part) and just update the "VehicleCombo" with your combo box name.

    Private Sub CustomerID_AfterUpdate()
    Me.VehicleCombo.requery
    End Sub

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

Similar Threads

  1. Replies: 3
    Last Post: 07-10-2012, 05:23 AM
  2. Replies: 14
    Last Post: 11-27-2011, 04:50 PM
  3. How Can I Create This Query
    By djclntn in forum Queries
    Replies: 3
    Last Post: 02-26-2011, 12:02 PM
  4. how create this query???
    By daniel.preda in forum Queries
    Replies: 7
    Last Post: 12-28-2010, 03:27 PM
  5. Using a query to create
    By DamnYankees in forum Queries
    Replies: 2
    Last Post: 10-08-2009, 07:38 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