run a search

  • Thread starter Thread starter Lynette
  • Start date Start date
L

Lynette

I want to build a form. I want the form to have a place
to enter people's interest in (excel, horses, children,
etc.) Then I want a command button to click to search for
that criteria in a table. How do I do it?

EX.I want to be able to type in excel, word and it give
me the records of everyone interested in excel and /or
word.
 
-----Original Message-----
I want to build a form. I want the form to have a place
to enter people's interest in (excel, horses, children,
etc.) Then I want a command button to click to search for
that criteria in a table. How do I do it?

EX.I want to be able to type in excel, word and it give
me the records of everyone interested in excel and /or
word.
.
Hi Lynette,
1. have unbound form with combination textboxes, option
groups and comboboxes (2 column - id, hidden, and
description) for users to make their selection.
2. listbox bound to a query (the example below uses a
query by the name, qrySearchResult) that lists all people.
3. have buttons such as search, display, reset, close.
4. when users click search have code inspect each control
to build an sql statement and assign to listbox of result.
for example

' declaration to include
dim strWhere as string
dim strSQL as string

' example to build where condition
if not isnull(cboAppID) then
if len(strWhere)>0 then
strWhere=strWhere & " AND "
end if
strWhere=strWhere & "((AppID)=" & cboAppID & ")"
end if

' example to build sql
' either set the listbox rowsource to query with no filter
or to sql with where conditions
if len(strWhere)>O then
strSQL = "select * from qrySearchResult " _
& "where (" & strWhere & ");"
else
strSQL="qrySearchResult"
end if


lstSearchResult.RowSource=strWhere

5. Perhaps use listbox double-click and command button,
Display to run a procedure to open a form to selected
listbox entry.
6. Use the reset button to clear all search options.

Hope that gives you enough pointers to set this up :-)

Luck
Jonathan
 
Back
Top