Results 1 to 3 of 3
  1. #1
    lman is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    3

    Passing a NULL value to a date field

    I'm sure the answer to this is simple, but i can't see the wood for the trees.



    I have several fields in an access query that i am passing parameters values to through VBA. I use the following statement in the criteria field of the query to check if the value passed is null

    Code:
     
    IIf([oper] Is Null,"*",[oper])
    [oper] is the parameter, and if null it displays all the records ("*").

    This works fine expect for a field that has a date/time data type. (data type mismatch). I have tried something like

    Code:
    IIf([oper] Is Null, > 01/01/00, [oper])
    but this doesn't display anything.

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    try:
    IIf([oper] Is Null, > #01/01/00#, [oper])

    or
    Nz([oper], >#01/01/00#)

  3. #3
    lman is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    3
    Well unfortunately neither of those worked but i did find a solution, i noticed if you just put an * in the criteria access modifies it to Like "*" so i changed it to

    Like [oper] and "*"

    and it works perfectly

    thanks for your help!




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

Similar Threads

  1. Conditional format for Null date
    By azaz in forum Forms
    Replies: 1
    Last Post: 12-27-2010, 03:11 AM
  2. Replies: 2
    Last Post: 09-27-2010, 02:17 PM
  3. bypassing passing parameter when null
    By cowboy in forum Queries
    Replies: 11
    Last Post: 04-14-2010, 09:59 PM
  4. detecting a null date
    By tedpottel in forum Queries
    Replies: 3
    Last Post: 03-02-2010, 01:45 PM
  5. Null Date control code problem
    By DanW in forum Forms
    Replies: 2
    Last Post: 11-10-2009, 03:13 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