Results 1 to 9 of 9
  1. #1
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    98

    Unhappy Unanswered: What am I doing wrong with this code?

    In one of my queries I have placed this code to calculate the days between begindate (datum_nu) and signoff date (Afgemeld_datum). If there is no signoff date then the current date is selected.

    This whole thing worked before but now, all of a sudden I get an error stating this function is not available in expressions.

    PLEASE HELP! this is the code:

    IIf([tblMelding]![Afgemeld_datum] Is Not Null;DateDiff("d";[tblMelding]![Datum_nu];[tblMelding]![Afgemeld_datum]);DateDiff("d";[tblMelding]![Datum_nu];Date()))

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    PHP Code:
    IIf(Not IsNULL([tblMelding]![Afgemeld_datum]);
      
    DateDiff("d";[tblMelding]![Datum_nu];[tblMelding]![Afgemeld_datum]);
        
    DateDiff("d";[tblMelding]![Datum_nu];Date())) 

  3. #3
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    98
    I get the same message. Am I overlooking something?

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    What is the error message you got?

  5. #5
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    IIf(Not IsNULL([tblMelding]![Afgemeld_datum]);
    DateDiff("d";[tblMelding]![Datum_nu];[tblMelding]![Afgemeld_datum]);
    DateDiff("d";[tblMelding]![Datum_nu];Date()))

    1st replacing the ; with the , still getting the errors ???

    if is WAS working then has the data changes ?? is the date feilds still date feilds (Values) ???
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  6. #6
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    98
    I replaced the ; with , but this did not work. The text I get is (I am translating this from Dutch to English so please bare with me):

    "This function is not availabla in expressions in query-expressions [the expression]"

  7. #7
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    I had such error , are you running it under Office 2003?

  8. #8
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    98
    No I'm running it under 97. Do you think that is the problem?

    Does anyone, by any chance, know what I could change about the code to get the result I need? I can't think of another way than using dateDiff but maybe someone else can?

  9. #9
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    change the logect
    IIf(Not IsNULL([tblMelding]![Afgemeld_datum]);
    DateDiff("d";[tblMelding]![Datum_nu];[tblMelding]![Afgemeld_datum]);
    DateDiff("d";[tblMelding]![Datum_nu];Date()))

    to

    IIf(IsNULL([tblMelding]![Afgemeld_datum]);
    DateDiff("d";[tblMelding]![Datum_nu];Date());DateDiff("d";[tblMelding]![Datum_nu];[tblMelding]![Afgemeld_datum]))

    Question can a IIF() handle the not Isnull() ???????????
    never done your way
    I always use the IIF() with the Isnull() only

    what about the "d" to 'd' or is this a Dutch to English thing
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •