Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LARGE Query, need suggestions

Status
Not open for further replies.

MichHart

Programmer
Dec 14, 2002
56
0
0
CA
Hi everyone:

I am sort of new to this SQL stuff so I am hoping someone can lead me in the right direction with this:

I have a form that has several choices that a user can make to filter the master table by Name. On this form there are 2 sets of option buttons (3 choices each) 3 checkboxes, 8 combo boxes the user can choose one from eah combo box, and a date field that can be set.

I am looking for suggestions on how to set this up in SQL to filter on any and all the choices the user has.

Any help would be greatly appreciated.

MichHart " Never regret yesterday because it cannot be changed;
Instead make sure today does not become a regret of tomorrow."
 
Mich:

I have one form that has about 9 option boxes and the following statement in the criteria of the Query is placed under each Field across the first row (AND condition); it passes up on the NULL (or false return) and returns those option boxes that have been checked). You might be able to modify this somewhat:

Like (IIf([Forms]![frmFieldData]![optA]=-1,"*" & [Forms]![frmFieldData]![County] & "*","*"))

or it there is an exact match:

Like (IIf([Forms]![frmFieldData]![optA]=-1,[Forms]![frmFieldData]![County],"*"))

The SQL for the latter statement is:

SELECT tblFieldData.Site_ID, tblFieldData.County, tblFieldData.Binder_No, tblFieldData.Type, tblFieldData.Activity...
FROM tblFieldData
WHERE (((tblFieldData.County) Like (IIf([Forms]![frmFieldData]![optA]=-1,[Forms]![frmFieldData]![County],"*"))) AND ((tblFieldData.Type) Like (IIf([Forms]![frmFieldData]![optD]=-1,[Forms]![frmFieldData]![cboType],"*"))) AND ((tblFieldData.Activity) Like (IIf([Forms]![frmFieldData]![optE]=-1,[Forms]![frmFieldData]![cboActivity],"*")))...
ORDER BY tblFieldData.Site_ID;

...this might help ya get started.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top