Search through Forms

K

KKash

I want to put a Search field on a Form looking for a specific Profile ID.
There are Thousands of Forms/Records so using a Combo Box or List Box is not
neccessarily the easiest thing to utilize. I want to be able to enter the
Profile ID I'm looking for and then hitting a search button to find the
Form/Record. Any help with this would be appreciated. Thanks!
 
F

fredg

I want to put a Search field on a Form looking for a specific Profile ID.
There are Thousands of Forms/Records so using a Combo Box or List Box is not
neccessarily the easiest thing to utilize. I want to be able to enter the
Profile ID I'm looking for and then hitting a search button to find the
Form/Record. Any help with this would be appreciated. Thanks!

What are "Forms/Records"?

Records are stored in a table.
Forms 'display' or manipulate those records.
Actually, a combo box is the easiest and fastest method to locate a
specific record. Furthermore, the combo will only show ProfileID's of
those already in the database, therefore an incorrect user entry will
not be allowed.

Add a combo box to the form header. Use the Combo Box Wizard to do
this.
Select the 3rd option on the first page of instructions, something
like "Find a record ....".

When done make sure the combo box AutoExpand property is set to Yes.
Start entering the ProfileID. As you enter the ID, the Combo will jump
to the first ProfileID value that match the entered ID values. When
done the form will display that record.
 
K

Klatuu

I would use a Combo box. You certainly don't have thousands of forms. You
may have thousands of records, but they will all use the same form object.
Don't get forms and data confused. Only tables contain data. Forms are only
a way to view and manipulate the data in the tables.

But, if you want to use a text box instead:

Private Sub SearchBox_AfterUpdate()

With Me.RecordsetClone
.FindFirst "[ProfileID] = " & Me.SearchBox
If .NoMatch Then
"No Matching Record For " & Me.SearchBox
Else
Me.Bookmark = .Bookmark
End If
End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top