Results 1 to 4 of 4
  1. #1
    willkr is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2023
    Posts
    110

    Adding a WHERE clause with a text modifier

    I'm using a SELECT statement in a form to specify which data to get. One of the fields is a short text field that can be either "State" or "Local." I've tried a WHERE clause that says

    WHERE table.field= "State" to isolate only those records that have the locale set to State. I keep getting errors. I tried a single quote instead of a double quote and I've tried a double-double quote, but they all give me errors. How can I specify only records with locale = State?

    willkr

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Why would you use table.field? Surely table is not named "table" and field is not named "field"?

    SELECT * FROM YOURtablename WHERE locale = "State";

    should work
    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
    willkr is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2023
    Posts
    110
    OK June7, bear with me and forgive me for long field names. Here's the exact SELECT Clause for the form (not the locale form, but the savings form):

    SELECT tblSavingsDepWith.[Savings DepWith Number], tblSavingsDepWith.[Savings DepWith Date], tblSavingsDepWith.[Savings DepWith Amount], tblSavingsDepWith.[Savings DepWith Who], tblSavingsDepWith.[Savings DepWith Cleared], tblSavingsDepWith.[Savings Account] FROM tblSavingsDepWith WHERE tblSavingsDepWith.[Savings DepWith Type]=”With” ORDER BY tblSavingsDepWith.[Savings Withdr Date];


    Now, what do I need to change in the WHERE clause to make it work?

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430

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

Similar Threads

  1. Replies: 3
    Last Post: 09-09-2022, 01:47 PM
  2. Replies: 6
    Last Post: 01-02-2018, 10:56 AM
  3. Replies: 21
    Last Post: 02-03-2012, 03:36 PM
  4. Problem Adding WHERE Clause
    By zephaneas in forum Queries
    Replies: 1
    Last Post: 08-14-2011, 11:26 PM
  5. Adding an additional WHERE clause
    By Pells in forum Queries
    Replies: 7
    Last Post: 10-28-2010, 12:44 PM

Tags for this Thread

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