Database Search Form

N

Nicholas

I have an mdb database generated by FP2000 where I want to
have a search form search a field called Headline. Here is
the query in the FP asp.

fp_sQry="SELECT * FROM Results WHERE (Headline
= '::Headline::')"

With the search form there, this setup will not return any
records ever, either through the form or through an ASP
generated drop down I have. Taking the drop down out makes
no difference.

If I remove the search form, it returns all of the records
on loading as a result (I guess) of this query:

fp_sQry="SELECT * FROM Results"

The search form and drop down don't have any effect: it
returns all of the records when the page reloads.

I'm pulling my hair out as I have a different database set
up almost exactly the same way that works fine. The only
major difference between them is that the one that doesn't
work has 42 columns or fields total versus 13 in the one
that works.

Is the mdb corrupted or has errors, maybe? I don't have
Access to open it.
 
K

Kathleen Anderson [MVP - FP]

Try substituting a valid value for ::Headline:: in your query statement and
see what you get.
 
J

Jim Buyens

Are you entering the entire headline text?

Because, if, as I suspect, you actually want to search for
words in a headline, your query needs to be:

SELECT * FROM Results
WHERE (Headline LIKE '%::Headline::%')

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
N

Nicholas

Thank You Again! You are my SQL expert!

The search form now works. But, what happens is it loads
all of the records when you first visit the page or if you
do a null search. My other db doesn't do this. It returns
no records on load or on a null search.

Actually, with both pages I would like to have certain
records show when the page first loads. On one, the
current month's records and on the other, a specific
record that is just in there.
 
J

Jim Buyens

That would be something like:

SELECT * FROM Results
WHERE IIf('::Headline::'='', Now() - [articledate] < 30, [Headline]
Like '%::Headline::%')

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
N

Nicholas

Thanks again. I'll try it later today. SQL seems to be an
art form unto itself.

-----Original Message-----
That would be something like:

SELECT * FROM Results
WHERE IIf('::Headline::'='', Now() - [articledate] < 30, [Headline]
Like '%::Headline::%')

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------



"Nicholas" <[email protected]> wrote in
message news: said:
Thank You Again! You are my SQL expert!

The search form now works. But, what happens is it loads
all of the records when you first visit the page or if you
do a null search. My other db doesn't do this. It returns
no records on load or on a null search.

Actually, with both pages I would like to have certain
records show when the page first loads. On one, the
current month's records and on the other, a specific
record that is just in there.

want
to Here
is return
any database
set
.
 

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