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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help on a conditional form 1

Status
Not open for further replies.

GIJoeFigure

Technical User
Jun 16, 2004
27
US
I have been planning a conditional form to select certain header attributes of medical image files and create a query of the image files in the ~30 column table that meet the requirements. I was thinking that I could make toggle switches to include or disinclude each column information. For example, include the column that indicates body part and not the one that indicates the institution that the x-ray came from, and add the string values for each column query into one DoCmd.ApplyFilter statement. What I really would like is to know some basics about making this type of querying form and a little advice. Thanks so much in advance.


J. Handfield
Interning Scientist
Eastman Kodak Research Labs
Rochester, NY 14650
 
Also, I meant to mention that I am trying to use three text boxes and four combo boxes that are already set up with choices that the column may have in it, so i'm only really querying at max 7 columns and most often 3-4 columns each time I use the form. Thats what I'm looking for anyway. Thanks

J. Handfield
Interning Scientist
Eastman Kodak Research Labs
Rochester, NY 14650
 
Code:
WhereClause = ""
if me!checkbox1 = true then
WhereClause = WhereClause & "[Field1] = '" & me![Field1] & "' AND "
End if
'Repeat for all fields you want to add to the where clause

'Chop off the last AND
if len(WhereClause) > 0 then
WhereClause = Left(WhereClause, Len(WhereClause) - 4)
End if
if your fields are text you need the ' around the criteria, dates #s and numbers don't need anything.
HTH
Peter
 
Thank you Peter for your concise solution. That will definitely work well and adapt well.

Joe

J. Handfield
Interning Scientist
Eastman Kodak Research Labs
Rochester, NY 14650
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top