Results 1 to 4 of 4
  1. #1
    excellenthelp is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Mar 2014
    Posts
    93

    Calculated Field with Appropriate Operators?

    Accessors,



    I want to figure out how to formulate a calculated field properly that would look for records that has at least 'annual report' in a specific field.
    For example, a record with a field ([DocumentType]) with "2013 annual report", another record with a field ([DocumentType]) with "2012 annual report" and then I would like to count in those records and exclude the other records.

    Here is the formula I wrote:
    Code:
    Report: IIf([TABLE]![DocumentType]<>"Annual Report",[TABLE]![Name],"")
    Maybe I am using the wrong operator or something....?

  2. #2
    excellenthelp is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Mar 2014
    Posts
    93
    maybe I should use a wildcard in the formula? I am not sure how to...

  3. #3
    jfg863 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    7
    Well since you want "Annual Report" to show up, the <> symbol means does not equal "Annual Report" so that would make it where it would not show up. I would try just going to the specific column that has those words in it and make a query that you could put in the criteria of: Like * & "Annual Report" & *

  4. #4
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    You need to use the Instr function, which looks for the starting position of one string within another longer one. In your case, you need to look for the string "Annual Report" in the table field [DocumentType], something like this:

    IIf(instr([TABLE]![DocumentType], "Annual Report") > 0 ,[TABLE]![Name],"")

    If you want to use this to include or exclude records for inclusion in a report, this is not quite the right approach - can you clarify waht you are trying to do?

    John

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

Similar Threads

  1. Replies: 1
    Last Post: 04-21-2013, 03:20 PM
  2. Replies: 3
    Last Post: 02-13-2013, 10:15 AM
  3. IIF query using OR operators not working
    By Reigncloud in forum Queries
    Replies: 5
    Last Post: 02-16-2012, 04:02 PM
  4. List box with operators
    By akingsley in forum Programming
    Replies: 8
    Last Post: 11-06-2010, 05:59 PM
  5. Adding Mathematical Operators to my QBF
    By Silver Rain 007 in forum Queries
    Replies: 1
    Last Post: 11-05-2009, 08:54 AM

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