Results 1 to 3 of 3
  1. #1
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318

    Snytax Error - Counting a Not Null field

    The below formula is counting the records that have null fields in the InspDate. What is wrong in the syntax?



    =[YrInpDueG0]-Sum(IIf([FSL]=0,IIf(Not IsNull([Insp_Date]),1,0)))

  2. #2
    help_me_with_access is offline help_me_with_excel
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    262
    not sure, but thinking more than likely it's because you're using the visual basic syntax needed for NULL checking instead of the interface-based syntax. as far as I know, these are the general rules that seem compatible with acc:

    interface work:

    1) [field] is/is not NULL => e.g. ...... iif([field1] is not null, val1, val2)
    2) [field] (operator) NULL => e.g. ...... iif([field1 = null, val1, val2)

    visual basic:

    1) if isnull([field]) => e.g. ...... iif(isnull([field1]), val1, val2)
    2) if isnull([field]) = true => e.g. ...... iif(isnull([field1]) = true, val1, val2)

  3. #3
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318
    Ended up using =[YrInpDueG0]-Sum(IIf([FSL]=0,IIf([Insp_Date]<>" ",1,0)))

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

Similar Threads

  1. Preventing a Null error
    By tylerg11 in forum Forms
    Replies: 15
    Last Post: 06-23-2012, 11:18 PM
  2. If/Then Null based on Null Value of Another Field
    By vbpeterson in forum Queries
    Replies: 11
    Last Post: 06-05-2012, 05:00 PM
  3. sum function counting field name I think...
    By sfgiantsdude in forum Access
    Replies: 16
    Last Post: 03-06-2012, 04:42 PM
  4. Replies: 4
    Last Post: 10-08-2011, 06:31 AM
  5. Counting Characters in a text field
    By velvettiger in forum Queries
    Replies: 1
    Last Post: 03-12-2010, 12:36 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