Is there reason to have the field name as part of the variable?
If you want to use different fields in the query try use two variables.
MyField = "PartNum"
MyQuery = "1234"
SQL = "SELECT * FROM Gifts WHERE '" & MyField & "' = '" & MyQuery & "' "
The how I would do this via handcoding
You can see what is happening with your query by doing:
Response.Write SQL
--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)
FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
To assist you in getting the best answers for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
The variable "myquery" completes a valid SQL statement. My original
example was a simplified version of what I'm trying to do. For testing,
my ASP code includes the following line:
myquery="(PartNum = '1234')"
and my DRW SQL code is:
SELECT * FROM Gifts WHERE ::myquery::
I thought it would be straight forward and the variable would be
replaced. I even created a form field on the page and have made the
Intial Value to be:
<%Response.Write(myquery)%>
so that I can see that my variable was defined and displays, which it
does. However for the DRW results, I get the following error when
instead I should get my one record:
Database Results Error
Description: Syntax error in WHERE clause.
Number: -2147217900 (0x80040E14)
Source: Microsoft JET Database Engine
If I then define a default value for "myquery" to be:
(PartNum = '4567')
I DRW returns the default PartNum 4567 record to me.
So I know my query is right. Now if my variable would get replaced, I'd
get record 1234 returned rather than the default value which is being
returned instead of an error.
MR
in message I see in your first post that the variable is called myquery - where
does
that come from and what does it look like?
--
~ Kathleen Anderson
Microsoft MVP - FrontPage
Spider Web Woman Designs
web:
http://www.spiderwebwoman.com/resources/
blog:
http://msmvps.com/spiderwebwoman/category/321.aspx
Yeah, that's where I'm at now. While learning ASP would be a good
long term investment, I was hoping for a 5 minute fix for something I
may have overlooked. Any idea if it is possible to use an ASP
variable in DRW or is learning ASP my only solution? I'm fine if
learning ASP is the only way, but I've found that I could make
FrontPage do a lot more than I originally thought with some help from
the newsgroups and sites around the web.
MR
in message It's a matter of finding the time, I think. When I get a request
from a user, it's always quicker for me to use the DRW then to take
the time - at that point in time - to learn ASP.
--
~ Kathleen Anderson
Microsoft MVP - FrontPage
Spider Web Woman Designs
web:
http://www.spiderwebwoman.com/resources/
blog:
http://msmvps.com/spiderwebwoman/category/321.aspx
True, but if one feels confident enough to try to modify
FP-generated code, why not take the next step and write your own? A
trial-and-error process playing with DRW could cost you more time
than simply writing a couple of lines of code.
I don't claim to able to provide definite answers, only opinions...
TB
"Kathleen Anderson [MVP - FrontPage]" <
[email protected]>
wrote
in message Once you have touched up some code in a DRW section, you can
no longer open that file in FP as the program will detect the
changes and "repair the damage".
If that happens, it means you changed the code in the wrong place.
--
~ Kathleen Anderson
Microsoft MVP - FrontPage
Spider Web Woman Designs
web:
http://www.spiderwebwoman.com/resources/
blog:
http://msmvps.com/spiderwebwoman/category/321.aspx