Results 1 to 2 of 2

Thread: DATE in SQl QUERY

  1. #1 Guest

    Default DATE in SQl QUERY

    I have a form that has three drop downs on it (month, day , year)<BR><BR>Now my DB has a one field (that is a number, short format date).<BR><BR>my sql query is like this<BR><BR>select.....where date like #day/month/year#....<BR>day month and year are set to the value of the fields in the form.<BR><BR>Ok(if there is one) what is the &#039;wild card&#039; when it comes to dates (so I can set the default to it)<BR>also what&#039;s wrong with the statement? I get the error "Syntax error in date in query expression " and its shows the <BR>date as #%/%/%# (cause I set the default to % for each variable....)<BR><BR>Any help will greatly be appreciated..<BR><BR>Jeremy

  2. #2
    J. Paul Schmidt Guest

    Default Date Parts (M/D/Y) in SQL

    Instead of the following:<BR>"select.....where date like #day/month/year#.... "<BR><BR>Perhaps try something like this:<BR>"SELECT ... WHERE MyDateFld = #" & DateSerial(MyYrVar, MyMoVar, MyDayVar) & "#..."<BR><BR>And Like % is intended for non-numeric fields although I suppose it wouldn&#039;t hurt to TRY IT on a date field on your server.<BR><BR>Best regards,<BR>-Paul<BR><BR>J. Paul Schmidt, MBA<BR>Databases on the Web<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