Results 1 to 2 of 2
  1. #1
    trb5016 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2009

    Custum Functions in Query "WHERE" Clause

    I'm trying to use custom functions in a queries WHERE clause.

    In Att 1 & 2. You can see the custom function in "Expr1" and that it works correctly when the output of the function is pasted directley into the where box. Also note, that RunDate() is a custom function and works fine.

    However when I put the function directly into the where box, it returns no records (presumeably because it's comparing [Report Type] to the literal function name.

    I think I understand that the "<" sign is what is making it work for RunDate, can I get the same functionality for non-date fields?

    Background if you care:
    The RunDate in many queries, in case the user wants to simulate running the report on a different date.

    The Report Type needs to be able to change while a form is open. Otherwise I would just set the query def with vba since this is the only query that needs this dynamic filtering.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    The Great Land
    This is a function calling a function to generate the criteria. Would need to analyse code, even better would be to have the project so could test with data.
    How to attach file: To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 16
    Last Post: 07-22-2011, 09:23 AM
  2. "And" stops functions from working
    By JimmD43 in forum Programming
    Replies: 5
    Last Post: 03-19-2011, 11:10 AM
  3. WHERE clause "too complex"
    By Ted C in forum Queries
    Replies: 4
    Last Post: 06-30-2010, 12:08 PM
  4. Report "WHERE" clause not working
    By rsearing in forum Reports
    Replies: 4
    Last Post: 05-26-2009, 02:07 PM
  5. Replies: 1
    Last Post: 12-11-2008, 01:28 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 - Senior Forums