Modify query variable for Database lookup??

J

Julie

Hello all.

We have a page originally generated by FP's DRW
which we modified to our liking (all future changes will be
done in the page's code manually.) The user enters a value
into a field called XGINPUT.

What we'd like to do is strip superfluous characters a user
may type in prior to the lookup. For example:

Good input -> AB12345
Bad input -> AB-12345
Bad input -> AB-12,345

We have written a VB script that takes the value from Request.Form("XGINPUT")
and removes these characters, placing the 'cleaned' value into a variable called
XGCLEAN. But we don't know how to either:

a) place this XGCLEAN value into XGINPUT prior to the searching, or

b) modify the FP-generated command:
fp_sQry="SELECT * FROM tblX WHERE (XGR = '::XGINPUT::')"
so that it uses the new variable XGCLEAN instead of the form field XGINPUT.

Any suggestions?

Thanks.
 
K

Kevin Spencer

Use form validation. There's no guarantee that the user will use any of the
formats you specified. The user could put the data in in any form at all.

As a specific answer to your question, if the variable is declared in the
same page, you can simply concatenate it into the query string. Example:

Dim XGINPUT

XGINPUT = "AB12345"

fp_sQry="SELECT * FROM tblX WHERE (XGR = '" & XGINPUT & "')"

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.
 

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

Top