Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Date Function (Access 2000)

    I have a function defining the present date as follows
    Function finvoicedate()
    Dim invoicedate As Control
    Set invoicedate = Forms![FOrderInformation]![invoicedate]
    If invoicedate = ""
    Then
    invoicedate = date
    End If
    End Function

    My intention was to set the date to the present date of today if i have not chosen some other date.
    However somehow Acces does not accept this function and shows that there is not such date function.
    i.e. the errors is shown in invoice date = date.
    Could somebody advise me how can i have a function setting the date to the present date of today?

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Edmonton, Alberta, Canada
    Posts
    326
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Function (Access 2000)

    Try using date(). If that doesn't work, you may have broken references; in Visual Basic go to Tools | References and see if any are flagged as "Missing".

    I noticed another problem with your code - if invoicedate is a date field, you likely want to compare it to null, not "" (an empty string is not the same as null), with e.g.

    if isnull(invoicedate) ...

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Function (Access 2000)

    All Access have a date function.
    Try
    invoicedate = Format(Now(), "mm/dd/yyyy")
    If this also doesn't work, you may have a missing reference problem.
    In VBE, Open Tools, References and look for a checkbox marked MISSING. uncheck the checkbox near it.
    Francois

Posting Permissions

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