Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228

    unmatched query trouble

    Click image for larger version. 

Name:	Screenshot_1.png 
Views:	10 
Size:	10.9 KB 
ID:	28913

    I'm trying to create a query that I can use in a combo box. I want the combo box to only show "card name" where the selected person doesn't already have one. This here is giving no results. but I cant figure out why that is. any advice appreciated.

  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Is combo20 a list of names?

  3. #3
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    it is yes. their ID will be the saved field. I want it to show only cards they don't have already. the ones they do already have I can have an edit button for. But I don't want duplicates to be possible.

    I know I can do this using the key of the two tables involved but I don't think this should be too much trouble to just show the cards they don't have.

  4. #4
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    What happens when you replace = forms etc by a number.

  5. #5
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    a couple of things. I have tried the "is Null" on the work_cards field as this is where I believe it should be. still no joy. The reference to the combo box is correct. If I remove the is null it works like a normal select query and will show what they DO have.

    In this case the results will show a number in that field

  6. #6
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Work_cards.cardID cannot be null. It's a primary key.

  7. #7
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Yes that's what I mean. I didn't explain very well. I've moved the is null onto the work_cards field on then work card JB table. same results.

  8. #8
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Your join is wrong as only primary key values are allowed with copies from other table. Try right join.

  9. #9
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    still no joy mate. I would have thought that the table [work_cardsT] needs to show all because that is the list of cards. I have tied all sorts.

  10. #10
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    I think the fact its a junction table doesn't help. Ill look into it a bit more with junction tables.

  11. #11
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    I'll look if you've got a copy on here?

  12. #12
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    sure one sec, thanks.

  13. #13
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Database1 - Copy.zip

    I've deleted any sensitive data or edited it if needed.

    the main menu has a button called view work cards. open that.

    at the top right is a combo box and a button. when the button is pressed it should open the form for adding new cards for the selected person.

    I was working on the row source on that last form. (expiry dates add/edit). That is there the screenshot earlier came from. Thanks for your time also.

  14. #14
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Two queries. I called the first QRYHASONE (it selects who has a card)

    Code:
    SELECT Work_Card_JB.WORK_CARDS, Work_Card_JB.Contact_ID
    FROM Work_CardsT INNER JOIN Work_Card_JB ON Work_CardsT.Card_ID = Work_Card_JB.Work_Cards;

    Then a list of who hasn't from here

    Code:
    SELECT ContactT.Contact_ID, QRYHASONE.WORK_CARDS
    FROM ContactT LEFT JOIN QRYHASONE ON ContactT.Contact_ID = QRYHASONE.Contact_ID
    WHERE (((QRYHASONE.WORK_CARDS) Is Null));
    Hope this is it?

  15. #15
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    I'm sorry for the confusion. Ill have to explain better in future. I want to see in that combo box all the cards they do not have already.

    so the person ID is a constant (defined by the combo box) then if that person has a cscs card.. the user is unable to select cscs card. They should go to the existing record and edit instead.

    its getting there though. I see what you did with the query there. I may be able to work with this to see what I want.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. unmatched query problem
    By beginner33 in forum Access
    Replies: 1
    Last Post: 10-16-2016, 04:38 PM
  2. Unmatched Query
    By Dog17 in forum Queries
    Replies: 3
    Last Post: 08-07-2014, 02:36 PM
  3. Unmatched Query Qizard.
    By deepanadhi in forum Queries
    Replies: 7
    Last Post: 05-15-2012, 03:50 AM
  4. Replies: 1
    Last Post: 12-08-2011, 01:52 PM
  5. Unmatched query on 1 table
    By tmcrouse in forum Access
    Replies: 7
    Last Post: 06-01-2011, 08:38 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