Results 1 to 5 of 5
  1. #1
    newtoAccess is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Nov 2009
    Posts
    226

    Help needed with "and=" statement

    What am I doing wrong in this query statement?

    I am doing a test to confirm that the data is the same in three tables.
    All three are linked by IDNo.

    Field name: GradeGood:
    if "Table Data Detail. Field Grade" equals
    "Table for Search.field Grade" and also equals
    "Table Data. Field Grade"
    set field "Good" else "No

    The statement "and = [Table_Data]![Grade]" keeps disappearing from the statement after running it.



    The statement I am using is this:
    GradeGood: IIf([Table_Data_Details]![Grade]=[Table_for search]![Grade] And = [Table_Data]![Grade] ,"Good","NO")
    Last edited by newtoAccess; 12-06-2010 at 04:10 PM. Reason: Solved

  2. #2
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    You have to repeat the the field name in each AND part of the clause

    Code:
    GradeGood: IIf([Table_Data_Details].[Grade]=[Table_for search].[Grade] And Table_Data_Details].[Grade] = [Table_Data].[Grade] ,"Good","NO")
    Out of curiosity, why do you have the same information in multiple tables?

  3. #3
    newtoAccess is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Nov 2009
    Posts
    226
    In my first table, I have the main data entry from a form, The second is where I split the original data in to other fields.

    The third is a play area so I don't mess up the first two.

    When I play, experiment, I want to check from time to time to ensure that specific data has not changed and is still aligned up with the ID field.

  4. #4
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    Having the same info in multiple tables violates good database practices. In your main data entry form, either split the data into two controls (and two fields) or split it as it is being entered (via code). If you have a primary key field, you would use that and only that value to link to related tables. I guess we need to understand what your application is trying to do to be better able to help you.

  5. #5
    newtoAccess is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Nov 2009
    Posts
    226

    Thanks for the direction.

    This works for now and is all most complete.
    Data is being generated for reports that will end near the end of the month.

    I will think it over better if there is a next time.

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

Similar Threads

  1. Replies: 3
    Last Post: 04-10-2010, 10:22 AM
  2. Replies: 21
    Last Post: 06-03-2009, 05:54 PM
  3. aSTR = Dir("C:\*.*") >> "Type Mismatch"
    By JGrant in forum Programming
    Replies: 1
    Last Post: 03-28-2009, 05:17 AM
  4. Replies: 2
    Last Post: 08-31-2006, 12:19 PM
  5. "Count" and "Countif" in Reports
    By JMantei in forum Reports
    Replies: 1
    Last Post: 06-20-2006, 02:20 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