Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    Chunz is offline Novice
    Windows 10 Access 2013
    Join Date
    Jan 2016
    Location
    Tropical Paradise
    Posts
    8

    Cool Query Trouble!


    Hi, am trying to create a Query where Only the Persons who are Married would be showed? ANY IDEAS?
    Attached Thumbnails Attached Thumbnails QUERY TROUBLE!.jpg  

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    Seems like a very simple requirement. What is the difficulty you are having? I presume you are using the Access query builder. Set filter parameters on the Criteria row.

    Maybe:

    SELECT * FROM [Clients] WHERE [Marital Status] = "M";

    Might find this of interest http://www.allenbrowne.com/ser-62.html


    Advise not to use spaces or special characters/punctuation (underscore is exception) in naming convention.
    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
    Chunz is offline Novice
    Windows 10 Access 2013
    Join Date
    Jan 2016
    Location
    Tropical Paradise
    Posts
    8
    Thanks June 7, i got the first part with the parameters thing, but how do you get it to not prompt you for the values and just display the results?

  4. #4
    newbieaccess203 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2016
    Posts
    21
    Chunz,

    Make sure the M is in single quotes. 'M' instead of "M"

    let me know if it worked

  5. #5
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    What exactly is it prompting you for?

    Often times, if you have set up a query that is not a Parameter Query (which prompts the user for an entry), but you are getting a prompt anyway, it is usually sign of an error in your query. Most of the time it is a typo, or you are trying to reference a field name which does not exist in your dataset.

    So if it is prompting you for [Marital Status], it is telling you that it cannot find a field with that name. Double-check to make sure that you have the field name typed exactly correctly in your query.

  6. #6
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Make sure the M is in single quotes. 'M' instead of "M"
    That is really a SQL requirement.

    Access queries can use either single or double quotes.

  7. #7
    newbieaccess203 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2016
    Posts
    21
    Right after checking all that try if single quote works. [Marital Status]='M'

  8. #8
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Right after checking all that try if single quote works. [Marital Status]='M'
    As I mentioned, it doesn't make a difference in Access. Try it and see for yourself.

    Even if that was an issue, it probably wouldn't prompt you, it just wouldn't return the results you are expecting.
    Prompts usually happen when you set up your query as a Parameter Query, or when you use a field name (not field value) it cannot find.
    If you enter in a non-existent value for a particular field name, it just won't return any results.

  9. #9
    newbieaccess203 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2016
    Posts
    21
    You are right, but surprisingly I've seen sometimes it prompts in double quotes, which was weird

  10. #10
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You are right, but surprisingly I've seen sometimes it prompts in double quotes, which was weird
    It may have just been coincidence, as there might have been other issues (like unrecognized field names or from SQL instead of Access).

  11. #11
    newbieaccess203 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2016
    Posts
    21
    you might be correct

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    I just noticed your table name is spelled CIENTS, not CLIENTS. I presume you used CIENTS.

    Is the field name actually spelled MARITAL STATUS or is that an alias?

    Did you use the Access query builder to construct or did you type into SQL View?


    Did you post real names and phone numbers?
    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.

  13. #13
    Chunz is offline Novice
    Windows 10 Access 2013
    Join Date
    Jan 2016
    Location
    Tropical Paradise
    Posts
    8
    Yeah Sorry That was a Typo, Thnks For Pointing that out! i am kinda just running through here. and i used the builder as i am not so fancy with SQL

  14. #14
    Chunz is offline Novice
    Windows 10 Access 2013
    Join Date
    Jan 2016
    Location
    Tropical Paradise
    Posts
    8

  15. #15
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    Have to review your actual code so post the SQL statement of query you built or provide db. Follow instructions at bottom of my post.
    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.

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

Similar Threads

  1. Trouble with Crosstab Query
    By cbende2 in forum Access
    Replies: 3
    Last Post: 06-18-2015, 11:44 AM
  2. Trouble with Compound Query
    By bxdobs in forum Queries
    Replies: 3
    Last Post: 02-20-2015, 11:42 AM
  3. Trouble With User Query
    By wolfm in forum Queries
    Replies: 4
    Last Post: 02-12-2014, 03:51 PM
  4. SQL Query Trouble in Access
    By aglenn in forum Queries
    Replies: 4
    Last Post: 12-18-2013, 06:51 PM
  5. Trouble with Query
    By jbarrum in forum Access
    Replies: 1
    Last Post: 01-13-2010, 04:10 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