Using variables in sql query

Results 1 to 2 of 2

Thread: Using variables in sql query

  1. #1
    Ed Guest

    Default Using variables in sql query

    I am trying to use a variable in a sql statememt with no luck at is the SQL query:<BR>SQL_query = "SELECT * FROM room_master WHERE (selected_date) = " & qdate & "" <BR><BR>I tried:<BR>SQL_query = "SELECT * FROM room_master WHERE (selected_date) = &#039;" & qdate & "&#039;"<BR><BR>and get the same results.... <BR>[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. <BR><BR>qdate is a date formatted to short date format, selected_date is short format date in access 2000 db...<BR><BR>Can anyone provide any help?<BR>Thanks

  2. #2
    Eddie Campbell Guest

    Default RE: Using variables in sql query

    Access expects it&#039;s dates to be surrounded with # marks like this:<BR><BR>SQL_query = "SELECT * FROM room_master WHERE (selected_date) = #" & qdate & "#"<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