Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem: sql-Select with request.form

Status
Not open for further replies.

leifoet

Technical User
Jan 31, 2016
203
BE
application 1:
Code:
<form name = "list" onSubmit = "return validation (this);" METHOD = "POST" ACTION = "application2.asp"

Application2 => 'receives':
Code:
request.form ("ActID")
the value of request.form ("ActID") is (for example) 5

lngRecordNo = Request.Form("ActId")

This SQL works perfectly
Code:
StrSQL = "SELECT * FROM table_H INNER JOIN activity21 ON activity21.actID = table_H.actAnId WHERE ActId = 5 and membernr =" & Session ("uid")

if I replace 5 with the variable lngRecordNo i get an error message
Code:
StrSQL = "SELECT * FROM table_H INNER JOIN activity21 ON activity21.actID = table_H.actAnId WHERE ActId =" & lngRecordNo & "and membernr =" & Session ("uid")

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'ActId= and membernr=13'.

I also tried replacing the variable lngRecordNo with Request.Form("ActId") => same problem

Thanks for tips on how to fix this.

---
have now tested this :
response.write Request.Form("ActId") => result = 5
response.write isnumeric(Request.Form("ActId")) => true


 
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'ActId= and membernr=13'.

Always the same error message : the variable ActId becomes blank.
This error message only appears when the time condition is on.
If the time condition is skipped, the program will run without any problem - and always with the same Select query (query expression)
Thanks for help.
 
I am at a loss

I can't see how you would that error from the string

SELECT * FROM FROM table_H INNER JOIN activity21 ON activity21.actID=table_H.actAnId WHERE ActId=5 and membernr=13

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
I am looking further to solve this problem.
Thanks GriffMG for your suggestions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top