[AccessD] Building a search form

David McAfee DMcAfee at haascnc.com
Wed Mar 12 13:09:00 CST 2003


You can do it several ways. Does your first combo list only Topics
(textually), or do you have a hidden column 0 with an ID?

If no hidden ID field, then you can run code in the second combo box's
OnEnter event. Something Like (OTTOMH):
	If me.cboTopic = "(All)" then
		Me.cboQuestions.rowsource = "qryQuestionsAll"
	Else
		Me.cboQuestions.rowsource = "qryQuestionsFiltered"
	End IF

Or, if you are using a hidden Column(0), using ONE question query you can do
something like:

 1. Create a Union Query for the rowsource for cboTopic:
	SELECT TopicID, TopicTitle FROM tblTopics
	UNION
	SELECT "*" AS TopicID, "(All)" AS TopicTitle
	ORDER BY TopicTitle ASC;

  2. In your cbo.Question's rowsource query, create a column like (Also
OTTOMH):

	SELECT Q.ID, Q.Title
	FROM tblQuestions AS Q
	INNER JOIN tblTopicQuestionJunction AS TQJ
		ON TQJ.QID = Q.ID
	WHERE (((([Forms]![YourForm]![cboTopic] = "*") Or
([Forms]![YourForm]![cboTopic] = [QID]))=True))
	GROUP BY Q.ID, Q.title
	ORDER BY Q.title;


HTH 
David McAfee

-----Original Message-----
From: accessd-admin at databaseadvisors.com
[mailto:accessd-admin at databaseadvisors.com]On Behalf Of Klos, Susan
Sent: Wednesday, March 12, 2003 9:41 AM
To: 'accessd at databaseadvisors.com'
Subject: RE: [AccessD] Building a search form


Drew, my problem with that is the way I synchronize two combo boxes.  Each
is set to a query and I use the ID in the first combo as the criteria for
the query used as a source for the second box.  Now, what criteria do I use
for "all"?

-----Original Message-----
From: Drew Wutka [mailto:DWUTKA at marlow.com]
Sent: Wednesday, March 12, 2003 11:38 AM
To: ''accessd at databaseadvisors.com' '
Subject: RE: [AccessD] Building a search form


Hmmmm, why not just have two combos, Topic and Question.  Have an 'all' in
the Topic question, so that you can either select a Topic (and on the
Onclick requery the Question combo based on the Topic selection), or a
question.

Drew

-----Original Message-----
From: Klos, Susan
To: 'accessd at databaseadvisors.com'
Sent: 3/12/03 7:54 AM
Subject: [AccessD] Building a search form

I am creating a FAQ database.  I have the following tables: tblQuestion;
tblTopic; tblSource; tblReference; tblRelationship.  I am trying to
build a search form that can be used to find either the Topic, Question,
or Question when the Topic is known (in other words choose the topic
first then the questions relating to that topic show up in the question
dropdown.  I could do either the Topic or Question or the Question when
the Topic is known.  How do I do both on one form?



More information about the AccessD mailing list