Results 1 to 2 of 2

Thread: Dates are Not simple with Microsoft Access!!!!

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 1999
    Posts
    4

    Post

    Sorry to bother you again. I am stumped, and I have looked everywhere for
    the solution but cannot find it. You have in the past been so kind in
    helping me, I was wondering whether you would be prepared to help me again.

    THis is my problem. Dates in SQL with VB. Why doesn't the following code
    work!


    Set patientDataLEAP = dbLEAP.OpenRecordset("SELECT * From patientRecords
    Where DateOfRegistration < #01/08/99#")

    Or

    Set patientDataLEAP = dbLEAP.OpenRecordset("SELECT * From patientRecords
    Where DateOfRegistration < '01/08/99')

    Or

    Set patientDataLEAP = dbLEAP.OpenRecordset("SELECT * From patientRecords
    Where DateOfRegistration < " & Cdate(01/08/99))

    How can I compare dates? Help

    Any help is much appreciated.

    Cheers
    Angus


  2. #2
    Lively Member
    Join Date
    Jan 1999
    Posts
    82

    Post

    Hi,

    This is the right one:
    Set patientDataLEAP = dbLEAP.OpenRecordset("SELECT * From patientRecords
    Where DateOfRegistration < #01/08/99#")

    What you could do is try building the SQL statement in Access Query Designer. This will give you the correct syntax for your SQL Statement.

    Also, what is the error message that you get? It might not even be comparing dates!

    Preeti

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