Skip to main content
Participant
August 7, 2006
Question

Search using two criteria, using ASP/Access... argh!

  • August 7, 2006
  • 2 replies
  • 257 views
My head is about to explode from this.

Although multilingual, I am admittedly NOT literate in SQL or ASP or JavaScript... that's what DW is for, right? Hmmmmmm.....

So my REcordset's Advanced View SQL looks like this:

SELECT ComapnyName, Address1, Address2, City, PostCode, TelNumber, FaxNumber, EMail, WebsitefURL, MapURL, LogoImage, Keyword1, Keyword2, Keyword3, Keyword4, Keyword5
FROM Cardiff
WHERE Keyword1 LIKE 'varBusType' OR Keyword2 LIKE 'varBusType' OR Keyword3 LIKE 'varBusType' OR Keyword4 LIKE 'varBusType' OR Keyword5 LIKE 'varBusType' OR ComapnyName LIKE 'varBusName'


On my search page I have two text boxes, one for Business Name and the other for Business Type. When I search by Business Type, everyting is fine. When I search by BOTH, everything is fine.

But when I search by Business Name ONLY, I get a lovely long list of ALL the businesses in my database.

What am I doing wrong?

I've tried putting CompanyName first in the SQL, I've tried changing from LIKE to =, or to LIKE but with wildcards. NOthing.

Please save my sanity! 😉 My polyglot brain thinks everything looks lovely and logical, but my website has other ideas!

Regards,
Rabaab
This topic has been closed for replies.

2 replies

Rabaab_mAuthor
Participant
August 8, 2006
Yep, tried that too... no joy.

Oddly, when I leave BOTH text fields blank and hit the submit button, it gives me again ALL the database results,
so it seems the results page is ignoring the Business Name text box, or else treating it like a wildcard.

Any ideas anyone???

Rabaab




Try this,
AND ComapnyName LIKE 'varBusName'
Dave

"Rabaab_m" <webforumsuser@macromedia.com> wrote in message
news:eb8i4u$5up$1@forums.macromedia.com...
> My head is about to explode from this.
>
> Although multilingual, I am admittedly NOT literate in SQL or ASP or
> JavaScript... that's what DW is for, right? Hmmmmmm.....
>
> So my REcordset's Advanced View SQL looks like this:
>
> SELECT ComapnyName, Address1, Address2, City, PostCode, TelNumber,
FaxNumber,
> EMail, WebsitefURL, MapURL, LogoImage, Keyword1, Keyword2, Keyword3,
Keyword4,
> Keyword5
> FROM Cardiff
> WHERE Keyword1 LIKE 'varBusType' OR Keyword2 LIKE 'varBusType' OR
Keyword3
> LIKE 'varBusType' OR Keyword4 LIKE 'varBusType' OR Keyword5 LIKE
'varBusType'
> OR ComapnyName LIKE 'varBusName'
>
>
> On my search page I have two text boxes, one for Business Name and the
other
> for Business Type. When I search by Business Type, everyting is fine.
When I
> search by BOTH, everything is fine.
>
> But when I search by Business Name ONLY, I get a lovely long list of ALL
the
> businesses in my database.
>
> What am I doing wrong?
>
> I've tried putting CompanyName first in the SQL, I've tried changing from
LIKE
> to =, or to LIKE but with wildcards. NOthing.
>
> Please save my sanity! ;-) My polyglot brain thinks everything looks
lovely
> and logical, but my website has other ideas!
>
> Regards,
> Rabaab
>





Inspiring
August 8, 2006
Try this,
AND ComapnyName LIKE 'varBusName'
Dave

"Rabaab_m" <webforumsuser@macromedia.com> wrote in message
news:eb8i4u$5up$1@forums.macromedia.com...
> My head is about to explode from this.
>
> Although multilingual, I am admittedly NOT literate in SQL or ASP or
> JavaScript... that's what DW is for, right? Hmmmmmm.....
>
> So my REcordset's Advanced View SQL looks like this:
>
> SELECT ComapnyName, Address1, Address2, City, PostCode, TelNumber,
FaxNumber,
> EMail, WebsitefURL, MapURL, LogoImage, Keyword1, Keyword2, Keyword3,
Keyword4,
> Keyword5
> FROM Cardiff
> WHERE Keyword1 LIKE 'varBusType' OR Keyword2 LIKE 'varBusType' OR
Keyword3
> LIKE 'varBusType' OR Keyword4 LIKE 'varBusType' OR Keyword5 LIKE
'varBusType'
> OR ComapnyName LIKE 'varBusName'
>
>
> On my search page I have two text boxes, one for Business Name and the
other
> for Business Type. When I search by Business Type, everyting is fine.
When I
> search by BOTH, everything is fine.
>
> But when I search by Business Name ONLY, I get a lovely long list of ALL
the
> businesses in my database.
>
> What am I doing wrong?
>
> I've tried putting CompanyName first in the SQL, I've tried changing from
LIKE
> to =, or to LIKE but with wildcards. NOthing.
>
> Please save my sanity! ;-) My polyglot brain thinks everything looks
lovely
> and logical, but my website has other ideas!
>
> Regards,
> Rabaab
>