Combining search queries

sgtblitz

Registered User.
Local time
Today, 14:25
Joined
Feb 28, 2008
Messages
45
Hi there,

I will need to create a way of searching through products in a bookstore by product name, Author or by ISBN. Right now, I have designed 3 seperate queries, but to get more marks in my coursework I would have to combine the 3 queries to allow the user to be able search the three fields in the follwoing way:

Search by: Product Name AND/OR Author AND/OR ISBN

in other words, the user could have the option of searching by either product name, author or ISBN OR they could search by each individual criteria, or they could use a combination of two (e.g. Product name and author).

Could someone please help as i gotta get this sorted

Thanks

Dan
 
Use ONE query to search.
Code:
dim strSql as string
dim dbs as database
dim rst as DAO.recordset

strSql = "Select * from tableORquery where [Product Name] = '" & strProductname & "' or ISBN = '" & strISBN & "' or Author = '" & strAuthor & "'"

set dbs = currentdb
set rst = dbs.openrecordset(strsql)

if rst.recordcount =0 then
   msgbox "Selection unsuccesfull"
else
   msgbox "Found!"
endif
 
Similar Question

Hello,

I just posted a similar question because I was unsure if this method would work.

I have about 75 fields, with ~20 filtered in each query. Does your method allow me to combine each of these queries or will I need to retype? Thanks...I sent you a comment on your post too but I'm not sure if it went though.

If you're not sure what I'm talking about, check my post "Combining Queries with same fields" in the queries folder.

Thanks!
 

Users who are viewing this thread

Back
Top Bottom