Making a dynamic query form

Klion

Registered User.
Local time
Yesterday, 22:22
Joined
Jul 12, 2004
Messages
16
Didn't really know a name for what I wanted to do for title, so here is the explanation:

I am currently planning to make a form that will have listed on it all of the searchable fields for my database, then the user can choose to fill in whichever fields they want to search. At the bottom I will have an option group for "AND" and "OR" and based on their selection there the query will either do a search for every field that's been filled in or any field that has been filled in.

Now I have never tried anything like this, and in fact don't even know SQL. I need to know how plausible this is, so I can decide if I should go ahead and try this or if I should scrap it and just make the form have a listing of common queries. As it stands now there are about 16 text boxes and 13 check boxes. I can cut this number down further if I find the number of input fields to be an issue. Of the 16 text boxes 13 of the corresponding fields have info which is brought in by drop down combo boxes, so I know the possible choices. The other ones are just first name last name and student number.

Any help is appreciated, thanks.

-Klion
 
thanks those were a lot of help. One question, how would I modify this to make a query showing two tables instead of just one?

Alternatively if someone could tell me how to make the query show the plus signs so you can see related information like you can in tables that would work too.

Code:
strSQL = "SELECT * FROM " & Me!cboTable & " WHERE "


If cboFieldName1.Column(1) >= 1 And cboFieldName1.Column(1) <= 7 Then
    strSQL = strSQL & Me!cboFieldName1 & " " & Me![cboFirstOperator] & " " & Me![cboDescriptor1] & " "

db.QueryDefs.Delete "qryMyQuery"
Set qdf = db.CreateQueryDef("qryMyQuery", strSQL)
 
Last edited:

Users who are viewing this thread

Back
Top Bottom