Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Passing variable values to SQL queries

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-09-22 : 08:58:34
Pete writes "This is probably really easy but it's got me stumped. I keep using all posible vairations but can't get it to work. What is the correct syntax for passing a variable value into a SQL query to search an Access database.
I've got the line below:

SQL_query = "SELECT Name, Age, Sex, Link FROM friends WHERE Name = <%=Form_Name%>"

where Form-Name is the name of a variable passed to the ASP file by a page with the form on. I know the content of the variable is valid since

Name: <%=Form_Name%>


elsewhere on the page returns the correct value when the page executes on the server. The usual error I get are either Unterminated string constant.

Hope you can help,


Pete
"
   

- Advertisement -