Results 1 to 4 of 4
  1. #1
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129

    Open Report w DateAdd function

    Private Sub btnCertsExp_Click()


    DoCmd.OpenReport "rptCerts", acViewPreview, , "[CertDateExp] < " & DateAdd("m", 2, Date)
    End Sub

    so this opens my report but with no results - because I dont know how to get the Format right

    in the reports Filter Property I have [CertDateExp] < 21/04/2013 and of course if I change it to

    [CertDateExp] < #21/04/2013# all works well. I just need to know how to do this in the procedure

    Thanks everyone

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    With the non-US date format, you'll also have to watch out for:

    http://allenbrowne.com/ser-36.html
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129
    Whoah that was quick, and then I'd just finished rewriting the procedure and trying out and you posted again, it worked in down date format but I'll read up, I have made extensive use of the Allen Browne code for between two dates and in fact I spent a bit of time looking at that to try solving this.

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

Similar Threads

  1. DateAdd function for workdays?
    By 10 Gauge in forum Programming
    Replies: 2
    Last Post: 04-06-2011, 09:20 AM
  2. DateAdd Function
    By Desstro in forum Programming
    Replies: 3
    Last Post: 04-03-2011, 01:45 PM
  3. Calling A Module Function To Open A Form
    By orcinus in forum Modules
    Replies: 3
    Last Post: 09-29-2010, 04:43 PM
  4. Help Please - DateAdd Function
    By graviz in forum Queries
    Replies: 3
    Last Post: 03-02-2010, 02:34 PM
  5. search,view and open function
    By blurboy84 in forum Reports
    Replies: 0
    Last Post: 10-08-2009, 11:42 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