Syntax error with date.

Results 1 to 2 of 2

Thread: Syntax error with date.

  1. #1
    Petar Guest

    Default Syntax error with date.

    When I use <BR>Dim dtDate<BR>Date = "22/06/2001"<BR>objRS.Open "SELECT * FROM Power WHERE pDate = &#039;dtDate&#039;"<BR>I get the error.<BR>Syntax error converting character string to smalldatetime data type<BR><BR>When i use <BR>objRS.Open "SELECT * FROM Power WHERE pDate = &#039;06/22/2001&#039;"<BR>it works.

  2. #2
    Ghose Guest

    Default RE: Syntax error with date.

    Try the Cdate function...<BR><BR>Dim dtDate<BR>tDate = "22/06/2001" &#039;Date is the name of a function<BR>dtDate = Cdate(tDate)<BR>objRS.Open "SELECT * FROM Power WHERE pDate = " & dtDate<BR><BR>

Posting Permissions

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