Help with form results in query

K

Ken

How can I get this line to work? I am trying to get the results entered in a
form to be part of my query. I am able to get the form results but I get a
error stating Syntax error (missing operator) in query expression 'Assignee
= Tom Jones'.
Below is the line where the error occurs

Session("dbWhere") = "Assignee = " & Request.Form("assignsearch")

Thanks
Ken
 
T

Tom Kaminski [MVP]

Ken said:
How can I get this line to work? I am trying to get the results entered in a
form to be part of my query. I am able to get the form results but I get a
error stating Syntax error (missing operator) in query expression 'Assignee
= Tom Jones'.
Below is the line where the error occurs

Session("dbWhere") = "Assignee = " & Request.Form("assignsearch")

Session("dbWhere") = "Assignee = '" & Request.Form("assignsearch") & "'"
 
K

Ken

Now this is giving me problems. Is this the correct way ?
Session("dbWhere") = "Assignee = '" & Request.Form("assignsearch") & "'" or
"Add_Assignees = '" & Request.Form("assignsearch") & "'"
 
P

Phillip Windell

You can't use an "or" like that. You can't assign a value to a
Session variable with an "or". You can use an
"if...or...then...else" when testing for a current value, but you
haven't made it clear what you are trying to do. Let use know what you
are *really* trying to do,...you may have to change your whole
approach.

--

Phillip Windell [CCNA, MVP, MCP]
(e-mail address removed)
WAND-TV (ABC Affiliate)
www.wandtv.com
 
B

Bob Barrows

Ken said:
How can I get this line to work? I am trying to get the results
entered in a form to be part of my query. I am able to get the form
results but I get a error stating Syntax error (missing operator) in
query expression 'Assignee = Tom Jones'.
Below is the line where the error occurs

Session("dbWhere") = "Assignee = " & Request.Form("assignsearch")
Whenever you have this type of error, use response.write to see the results
of your concatenation. You have no hope of troubleshooting this just by
looking at the code. You need to see the result.

Bob Barrows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top