SQL Date filter problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • iheartvba
    New Member
    • Apr 2007
    • 171

    #1

    SQL Date filter problem

    Hi I have a query in access as follows:
    Code:
    strSqlBANK = "SELECT Dt , SumOfAmount " & _
    "FROM tblCASHBanked WHERE Dt = #" & dtBank & "#"
    dtBank has been dimmed as a date

    What happens is that dtBank will = 01/07/2008, but when I interogate the recordset !Dt = 07/01/2008.

    I get two different values
    when I run the following code:
    Code:
    msgbox Format(dtBank,"dd mmmm yyyy")
    the result is : 01 July 2008
    however when I run this code:
    Code:
    rst.Open strSqlBANK, cnn, adOpenDynamic, adLockOptimistic
    with rst
    msgbox Format(!dt,"dd mmmm yyyy")
    end with
    The result is: 07 January 2008

    It is driving me absolutley nuts
  • FishVal
    Recognized Expert Specialist
    • Jun 2007
    • 2656

    #2
    SQL accepts date constants in m/d/y format only.

    Regards,
    Fish

    Comment

    • iheartvba
      New Member
      • Apr 2007
      • 171

      #3
      ok, Thanks a lot FishVal

      Comment

      Working...