Results 1 to 4 of 4

Thread: Still having problems comparing dates.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Location
    Antrim
    Posts
    80

    Angry

    Hi,

    I have the following function in my application

    Print_Statement

    Dim appAccess as Access.Application

    Set appAccess = New Access.Application

    appAccess.OpenCurrentDatabase _
    ("G:\Wiz Add Ins\Energy Client\Database\Energy Client.mdb")

    appAccess.DoCmd.OpenReport _
    ("rptStatement", acViewPreview, , "[Date] = #" & Date & "#")

    This should return the report displaying only the data for the current date, however it returns no records at all.

    I had the same problem using the FindFirst Method recently and had to search records manually to find my data.

    This is not an option this time as the OpenReport command requires this WHERE clause like string.

    Any suggestions would be much appreciated as my application is now finished and I only have the reports left to configure.

    Best regards,

    Rob Brown.

  2. #2
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008

    Question Dates

    I have tried this and it does work - all I can suggest is that you explicitly format the date using Format(Date(), "ddmmyyy") or whatever.

    Are you getting US style dates back? Try setting your date to 10th October (10/10) and ensuring it works then. Dates are a bu**er though.

    Cheers,

    Paul.
    Not nearly so tired now...

    Haven't been around much so be gentle...

  3. #3
    Lively Member Kersey's Avatar
    Join Date
    Jun 1999
    Location
    The Netherlands
    Posts
    101


    you might try this
    Code:
    ("rptStatement", acViewPreview, , "[Date] = " & clng(Date) )

  4. #4

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Location
    Antrim
    Posts
    80
    Problem solved,

    Although the Date function was printing in the immediate window as DD/MM/YY it must have contained other information also.

    I found myself having to use:

    Format(Date, "Short Date")

    this works fine.

    Thanks for your suggestions anyway.

    Best regards,

    Rob Brown.

Posting Permissions

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



Click Here to Expand Forum to Full Width