Search box in form.

E

Eric C. Vogel

I got help from another newsgroup, but it was out of scope. Here is what I
was given

You could use "find" toolbar in Home tab to search for the record in tables.

If you'd like to do this in your own code, you could add textbox/button and
your findrecord function to do the job.


For example, FindField is the Field you want to search, txtSearch is your
search text field the user types into. You could use:

Private Sub cmdFind_Click()
On Error GoTo err_Handler

FindField.SetFocus

If FindField.SelText = txtSearch Then
DoCmd.FindNext
Else:
DoCmd.FindRecord txtSearch, acAnywhere, , acSearchAll, , acCurrent End
If

err_Handler:
Exit Sub

End Sub

I tried changing it to this: Did I do it right? and where do I put it? I
want to search Software Title and the field for the searching is named
search.

Private Sub cmdFind_Click()
On Error GoTo err_Handler

Software Title.SetFocus

If Software Title.SelText = Search Then
DoCmd.FindNext
Else:
DoCmd.FindRecord Search, acAnywhere, , acSearchAll, , acCurrent End If

err_Handler:
Exit Sub

End Sub

--
Thank you,
Eric Vogel
Computer Running Slow? Need PC Help? http://www.beacontechsolutions.com
http://blog.beacontechsolutions.com
http://www.msmvps.com/shelluser
 

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

Similar Threads


Top