Search text box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I would like to make a search text box on my form, that looks up the values
on my table. It would be a simple thing, you type what you want in the text
box, press the button and it searches in my table.

I´d like to know if that´s possible, if anybody knows please help me.

Thanks very much.
 
Access has a couple simple solutions. You can use Filter By Form to
accomplish what you're asking. Select "Records" - "Filter" - "Filter By
Form". Enter your criteria in the form to have Access filter those records.

Or...

You could add an unbound combo box to the form header or footer to search
for a given record or records. Use the wizard to create the combo box and
specify that you want it to search for data in your table.
 
Leandro,
I use a combo box that lists all the possible values to serach for. The
user selects a value, and on the AfterUpdate event of the combo, the record
is found.
For example, looking up a customerID (CustID)

Private Sub cboFindCustID_AfterUpdate()
Me.FilterOn = False
DoCmd.GoToControl "CustID"
DoCmd.FindRecord cboCustID
End Sub

hth
Al Camp
 
Thanks, but I´ve done that with the combobox and it searches only within one
field in the tables, as the table has a lot of fields, I´d like to be able to
search in more than one field.

The way I did it is: I made a query for each field of the table, so when you
select that certain field in the combobox it runs the query and opens the
dialog box asking what I want to find. The problem is, I can only do it with
one field at a time, so I´d like to do it with more than one field.

Thanks.
 
Yeah, I´ve done that, but that way I can only do it with one field at a time.
I´d like to be able to use more than one field at time.

Thanks.
 
Rowiga wrote...
Access has a couple simple solutions. You can use Filter By Form to
accomplish what you're asking. Select "Records" - "Filter" - "Filter By
Form". Enter your criteria in the form to have Access filter those records.

You wrote...
Thanks, but I´ve done that with the combobox and it searches only within
one
field in the tables, as the table has a lot of fields, I´d like to be able
to
search in more than one field.

No, you haven't... "Filter By Form" is not the same as using a combo box to
find a record. It allows you to search for records by applying criteria to
multiple fields on your form... which is what you requested.
Rowiga's solution is correct.

hth
Al Camp
 
The use of Filter By Form will allow you to search by multiple criteria. If
you want to use a searchable text box approach I'd create a form that has an
unbound text box (or unbound combo box) for each field that you want to
search for. The criteria to populate the editable form would be:

Forms![SearchFormName]![FieldA] OR Forms![SearchFormName]![FieldA] Is Null
Forms![SearchFormName]![FieldB] OR Forms![SearchFormName]![FieldB] Is Null
Forms![SearchFormName]![FieldC] OR Forms![SearchFormName]![FieldC] Is Null
etc...
 
Ok, Rowiga I´ll try that.

Thank you very much.

rowiga said:
The use of Filter By Form will allow you to search by multiple criteria. If
you want to use a searchable text box approach I'd create a form that has an
unbound text box (or unbound combo box) for each field that you want to
search for. The criteria to populate the editable form would be:

Forms![SearchFormName]![FieldA] OR Forms![SearchFormName]![FieldA] Is Null
Forms![SearchFormName]![FieldB] OR Forms![SearchFormName]![FieldB] Is Null
Forms![SearchFormName]![FieldC] OR Forms![SearchFormName]![FieldC] Is Null
etc...

Leandro A. said:
Yeah, I´ve done that, but that way I can only do it with one field at a time.
I´d like to be able to use more than one field at time.

Thanks.
 
I didn´t accually mean that one, I did the combobox one, I didn´t express
myself right. I am trying that now.

Thank you very much for your help.
 
Back
Top