Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

format date issue

Status
Not open for further replies.

tombino79

Programmer
Joined
Feb 6, 2008
Messages
1
Location
AU
Hi everyone,

I have a problem doing a query in ASP. This is my query:

Dim vardate
vardate = "#" & latestdate & "#"

sSQL1 = "SELECT tbl_size.sizename, tbl_stylesize.sizeid, tbl_stylesize.rate, tbl_stylesize.changedate " & _
"FROM tbl_stylesize " & _
"INNER JOIN tbl_size " & _
"ON tbl_stylesize.sizeid = tbl_size.sizeid " & _
"WHERE tbl_stylesize.active = -1 " & _
" AND FORMAT (vardate, "mm/dd/yyyy" ) = tbl_stylesize.changedate " & _
" AND tbl_stylesize.styleid = " & arrItem & _
" ORDER BY tbl_size.sizeid"

The problem is the " (ando may be also /)in the FORMAT date. It reconize it like a end of statement. I tryed to write

"" & mm & "/" & dd & "/" & yyyy & """ or
Chr(34) & mm/dd/yyyy & Chr(34)

but anything is working.
Can you please help me?

Thanks!

Best Regards,
Tom
 
If changedate is defined as DATE in tbl_stylesize:
Code:
" AND " & vardate & " = tbl_stylesize.changedate " & _

If defined as string:
Code:
" AND '" & Format(vardate, "mm/dd/yyyy") & "' = tbl_stylesize.changedate " & _


Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top