Results 1 to 8 of 8
  1. #1
    kheneasar is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Apr 2014
    Posts
    6

    #error after 2003 to 2010 Access upgrade

    Hi Everyone,

    We recently upgraded Access to 2010 and one of our queries now returns #error.



    =IIf(IIf(Month(Date())=1,13,Month(Date()))<2," ",Count(IIf(([OR_Test_Type_1]='ID Data' Or [OR_Test_Type_1]='Local / ID Data' Or [OR_Test_Type_1]='Local / MAC' Or [OR_Test_Type_1]='Topical / ID Data' Or [OR_Test_Type_1]='MAC / Topical / ID Sed' Or [OR_Test_Type_1]='Data Block' Or [OR_Test_Type_1]='Data Mac') And [Expr1]='01',[OR_Test_Type_1])))

    If we remove the text highlighted in red, it runs just fine. I'm guessing the Count is not returning a value when it looks for 'Data Block and Mac'? Does anyone know how to use HasData or maybe change the count to a sum operator to get this to work again?

    Thanks,
    Khen

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    This is SQL within an SQL statement? Where is your expression used, in a form, in a query object? Is Data Block and or Data Mac literal text? Perhaps you should test for null fields before applying results to your function.

  3. #3
    kheneasar is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Apr 2014
    Posts
    6
    Yes it's a SQL query tab in Access, used in a query object. Data Block and Data Mac both represent literal text.

    If a NULL field exists, does that mean it will always return #error in 2010 Access?

    Thanks

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    No idea why including those two parameters would cause an issue. Null field should not cause issue. I just tested a similar Count expression. I don't understand need for: AND Expr1='01'.

    Try:

    Sum(IIf(([OR_Test_Type_1]='ID Data' Or [OR_Test_Type_1]='Local / ID Data' Or [OR_Test_Type_1]='Local / MAC' Or [OR_Test_Type_1]='Topical / ID Data' Or [OR_Test_Type_1]='MAC / Topical / ID Sed' Or [OR_Test_Type_1]='Data Block' Or [OR_Test_Type_1]='Data Mac') And [Expr1]='01', 1, 0)))

    But I suspect will generate error as well if the issue caused by those two parameters.


    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.

  5. #5
    kheneasar is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Apr 2014
    Posts
    6
    Thank you. I'll give it a shot and let you know what happens.

  6. #6
    kheneasar is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Apr 2014
    Posts
    6
    I tried...

    Sum(IIf(([OR_Test_Type_1]='ID Data' Or [OR_Test_Type_1]='Local / ID Data' Or [OR_Test_Type_1]='Local / MAC' Or [OR_Test_Type_1]='Topical / ID Data' Or [OR_Test_Type_1]='MAC / Topical / ID Sed' Or [OR_Test_Type_1]='Data Block' Or [OR_Test_Type_1]='Data Mac') And [Expr1]='01', 1, 0)))

    and it's still returning #error.

    Anyone happen to have any other ideas? Thank you

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    If you want to provide db for analysis, 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.

  8. #8
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    to trouble shoot you should de-nest the nested IIF statements... temporarily...put each iif into its own field in query design mode...with some plugged filler values too....

    also I note seeing: [Expr1]

    while it might be your field name - it is often the default value applied to a missing field - so this could be an issue...



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

Similar Threads

  1. Replies: 22
    Last Post: 02-24-2014, 10:21 PM
  2. Replies: 2
    Last Post: 02-11-2014, 09:41 AM
  3. 2113 Error happening from Access 2003 to 2010
    By johnnyflames in forum Forms
    Replies: 5
    Last Post: 06-08-2012, 01:42 PM
  4. Upgrade database from 2003 to 2010
    By magua in forum Access
    Replies: 1
    Last Post: 06-06-2012, 01:58 PM
  5. Replies: 2
    Last Post: 05-19-2010, 02:01 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