ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old September 22nd, 2003, 01:48 AM
m175400 m175400 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 19 m175400 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Searching multiple memo fields in multiple tables in Access

I have a search option on my website, which should perform a search on 4 fields, as follows:

tblNews
headline
content

tblDatabank
filename
description

It only needs to return matches which are an exact match of their search criteria. For instance, searching for "I am here" would return a record which contained "I am here", but not just "I" or "I am" etc.

I need to return all these records as part of one recordset preferably, as I want to be able to order them etc., though I imagine you may suggest I use an array somehow to merge two recordets etc., then reorder them?

I hope someone can help...PLEASE!! )

Reply With Quote
  #2  
Old September 22nd, 2003, 01:59 AM
OldJacques's Avatar
OldJacques OldJacques is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: in Orbit mostly
Posts: 148 OldJacques User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
In order to return one recordset containing records from two different tables, there should usually be some logical relationship between the two tables which in this case isn't esplicit.

Then you need to write an SQL statement (usually JOIN) which has a WHERE part corresponding to something like:
WHERE headline = 'I am here' AND content = 'no I am not' AND ...
or maybe you mean:
WHERE headline = 'I am here' OR content = 'I am here' OR filename = 'I am here' ...

If you manage to relate the two tables so you can have one SQL statement, you can also add an ORDER BY filename DESC to order them without an array...

Reply With Quote
  #3  
Old September 22nd, 2003, 02:06 AM
m175400 m175400 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 19 m175400 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally posted by OldJacques
In order to return one recordset containing records from two different tables, there should usually be some logical relationship between the two tables which in this case isn't esplicit.

Then you need to write an SQL statement (usually JOIN) which has a WHERE part corresponding to something like:
WHERE headline = 'I am here' AND content = 'no I am not' AND ...
or maybe you mean:
WHERE headline = 'I am here' OR content = 'I am here' OR filename = 'I am here' ...

If you manage to relate the two tables so you can have one SQL statement, you can also add an ORDER BY filename DESC to order them without an array...


I gathered that this would be the easier way forward, but am a little confused i.e. there is no relationship between the tables.

The idea, is that those records from the databank table will then require the user to register before they can view it, and the matching records from the news table will be viewable without registration. The data in the tables refers to completely different topics.

Can you explain what you mean by this logical relationship please?

Reply With Quote
  #4  
Old September 22nd, 2003, 02:15 AM
OldJacques's Avatar
OldJacques OldJacques is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: in Orbit mostly
Posts: 148 OldJacques User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Quote:
Originally posted by m175400
...but am a little confused i.e. there is no relationship between the tables....and the matching records from the news table will be viewable without registration. The data in the tables refers to completely different topics.
Can you explain what you mean by this logical relationship please?
I am the one who is confused, I am afraid. If the data contained is completely separate, how do you propose putting them in the same RecordSet?
Managing permissions is something completely different, done on the level of the ASP Script which accesses the database, while composing the data into a useful format is what you will be using the SQL/ADO/RecordSets to do through creative querying .
The whole point of a RecordSet is that it is a set of somehow related data, at least theoretically (what I am understanding from your description would be like the phone numbers and addresses listed together in an PIM don't necessarily correspond to the same person)
or maybe you are trying to say something that one query (open to everyone) lets you see the list of people and phone numbers, while registered guests can see a nickname and e-mail address list (which could be a completely different set of people which has no relation to the first)

Just an example to try and understand, of course.

Normally there is a relationship (a common identifying field) in two tables that will be queried together, so that all the data on the same line is tied together by that (usually a unique identifying element like an ID number, an Order Number, or a Social Security Number, which only a limited number of records will have).

Last edited by OldJacques : September 22nd, 2003 at 02:20 AM.

Reply With Quote
  #5  
Old September 22nd, 2003, 02:38 AM
m175400 m175400 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 19 m175400 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Sorry, ignore my point about registering to view given fields, I can do this easily and it wasn't strictly necessary to tell you. Sorry if I added to the confusion as such!

I need to span the results (a preview of so many words..) over a number of pages, e.g. 4 results per page. This is why I thought it easier to create just one recordset rather than two somehow. From there users will be able to click the result in question to view it in its entirety.

Hence, if using two recordsets I thought perhaps I could populate an array from both recordsets and thus manipulate the data (i.e. order it or count the records etc.) returned from the query that way instead. For instance objRS.recordcount might equal 5, and objRS2.recordcount might equal 6. So that's 3 pages of results I'd need.

Hope this makes sense.

Reply With Quote
  #6  
Old September 24th, 2003, 11:18 AM
davegerard davegerard is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 15 davegerard User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 35 m 5 sec
Reputation Power: 0
I think you're going to need two recordsets. First one for Headline and Content and second one for FileName and Description. Carry the count of Recordset1 over to Recordset2 for a total count.

As far as displaying them to the user, you can make it look like it's one set of records.

Reply With Quote
  #7  
Old September 24th, 2003, 11:24 AM
m175400 m175400 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 19 m175400 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I've managed to get round it by changing the names of the fields in the two tables to both be

tagline
content

then using the following query:

strSQL = "select id as strID, tableID as strTableID, tagline as strTagline, content AS strContact FROM news where tagline LIKE '%" & searchString & "%' OR content LIKE '% " & searchString & "%' UNION ALL select id as strID, tableID as strTableID, tagline AS strTagline, content AS strContent from databank where tagline LIKE '%" & searchString & "%' OR content LIKE '%" & searchString & "%' ORDER BY strID"

thanks for your help everyone!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Searching multiple memo fields in multiple tables in Access


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway