• sql and dates (2002)

    Author
    Topic
    #424867

    Hi all,
    i know this must sound stupid. im trying to run an sql line in code. im putting a date in the sql string.
    the date is formatted dd/mm/yyyy just like the field its corresponding to.
    This is the end of the string

    ((tblSection6.Period)=” & “#” & Format(PDate, “dd/mm/yyyy”) & “#” & “));”

    doesnt seem to like it. anyone help me out?
    it just returns no recs when i know there are some there

    Viewing 1 reply thread
    Author
    Replies
    • #976996

      I believe that dates must be in format mm/dd/yy if you are going to embed them (that is, surround them with #…#). Not 100% sure on this, though.

    • #977001

      Mark is correct, dates MUST be in US date format in SQL, i.e. mm/dd/yy or mm/dd/yyy.

      By the way, you can simplify the expression to

      … tblSection6.Period = #” & Format(PDate, ” mm/dd/yyyy”) & “#)”

    Viewing 1 reply thread
    Reply To: sql and dates (2002)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: