Results 1 to 5 of 5

Thread: Access Code

  1. #1
    Join Date
    Jan 2004
    Posts
    5

    Question Unanswered: Access Code

    Can anyone help me out by letting me know what this code does???

    >=CVDate(IIf(Month(Date())<>1,Month(Date())-1,12) & "/" & "01" & "/" & IIf(Month(Date())<>1,Year(Date()),Year(Date())-1))


    Thanks!!!

  2. #2
    Join Date
    Jan 2004
    Posts
    184

    Re: Access Code

    I don't know what CVDate does but for the rest:

    If Month Not Equal to January THEN
    Month-1
    ELSE
    December
    ENDIF

    Concatenate

    /01/

    Concatenate

    If Month Not Equal to January THEN
    Year
    ELSE
    Year-1
    ENDIF

    Also, I just wanted to share with you a control that I have been using that has made my life easier:

    http://www.geocities.com/scirocco_ha/DataControl.htm

    Originally posted by bguymon
    Can anyone help me out by letting me know what this code does???

    >=CVDate(IIf(Month(Date())<>1,Month(Date())-1,12) & "/" & "01" & "/" & IIf(Month(Date())<>1,Year(Date()),Year(Date())-1))


    Thanks!!!

  3. #3
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238

    Re: Access Code

    Originally posted by bguymon
    Can anyone help me out by letting me know what this code does???

    >=CVDate(IIf(Month(Date())<>1,Month(Date())-1,12) & "/" & "01" & "/" & IIf(Month(Date())<>1,Year(Date()),Year(Date())-1))


    Thanks!!!
    It's finding the first day of the month prior to the current date...

    For example... If today is January 23, 2004
    The result will be ... >=#12/01/2003#

    If today is February 16, 2004
    The result will be ... >=#01/01/2004#

    Here's the breakdown...

    CVDate is an old function... that converts data to variant date type...

    The first If statement says...
    If the current month in not January Then
    the month is the current month - 1
    Else the month is 12 (December)

    Then it's concatenated with "/01/" to represent the day value...

    The second If statement says...
    If the current month is not January Then
    the year is the current year
    Else the year is the current year - 1

    The resulting concatenated string is all then converted to variant date data type...

    HTH

  4. #4
    Join Date
    Jan 2004
    Posts
    5

    Thank you very much

    I have racked my brain attempting to find out how IIF works, but to no avail. This helps greatly!!!

  5. #5
    Join Date
    Jan 2004
    Posts
    184

    Re: Thank you very much

    This function, also known as Immediate IF, evaluates a logical expression and then returns one of two expressions. If the logical expression evaluates to true (.T.), IIF( ) returns the first expression. If the logical expression evaluates to false (.F.), IIF( ) returns the second expression.

    Originally posted by bguymon
    I have racked my brain attempting to find out how IIF works, but to no avail. This helps greatly!!!

Posting Permissions

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