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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't Get Parameter to pass...

Status
Not open for further replies.

TheStriker

Programmer
Aug 19, 2002
109
US
Hello,

I can't for the life of me pass the form parameter to the next form using POST (Request.Form(LMID)). I'm trying to pass the Primary Key field to all of the pages but I keep getting the error:

'Syntax error in query expression: LMID='

I spent all day today trying to figure out the problem but to no avail. Any help is appreciated.
 
I'm not sure, but maybe you need quotes, like:
Request.Form("LMID")

or try:
Request.QueryString("LMID")
 
anneoctaaf,

Yes, I have tried both POST (Request.Form("LMID"))and GET (Request.QueryString("LMID")) but still get the same result. That is why it is so baffling to me. I'm really at my wits end on this one. The error message points back to my SQL statement where Dreamweaver inserts the following parameter:

...WHERE LMID=" + Replace(MM_ColParam, "'", "")

I've tried replacing this with the Request statements but to no avail. Please advise.
 
what is this POST(requestform("lmid")) you are trying to do!

POST is a method used to transfer the values of inputs within a form to the receiving page.

Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems
 
Just to make sure, can you try to give LMID a value, like:

<input type="hidden" size="3" name="LMID" value="1">

Let's see if it gets to the other page.
I think it's something with your sql, can you give me your whole sql statement? Because from what i can see LMID is a column in your database, not a form element...:)
 
ChrisHirst,

What I am trying to accomplish is a multipage survey. I need a way to pass the primary key to each page to pull up the same record. On the first page, I insert a record. On the following pages I'm trying to update the newly-created record. Since LMID is the primary key, I need to pass this to the other pages to update the correct record. I'm thinking the problem may be that the subsequent or update pages have bindings to recordsets with a filter i.e. LMID = Request.Form("LMID") of the previous page.

anneoctaaf,

Yes LMID is a PK column in my table. On the page, it is a hidden field with a dynamic value and named after the column name. I'm afraid if I give it a static value, it will pull up and update the wrong record. However with I do a Response.Write(value of field) it gives the correct value of the field. But it won't allow me to pass it on to the other forms or pages. I'm really scratching my head on this one.

Question:

Does it matter what form you are requesting values from?
I have a different form on each page with a different name and it just seems that Request.Form() is a bit ambiguous. How does it know what form you are referring to?

Thanks again
 
request.form() just retrieves the values sent from the submitting form. the form name is not used unless you are using DOM to get the values.

so your code would be

Code:
LMID = request.form("lmid")
....

strSQL = "...... WHERE LMID = " & LMID & ";" 'if lmid is numeric

strSQL = "...... WHERE LMID = '" & LMID & "';'if lmid is a string

to pass the same ID onto the next page use

Code:
<input type="hidden" name="lmid" value="<%=LMID%>">
in your form.



Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top