Solved

Access 2007 Form - Find Command or Search Text Box Needed

Posted on 2009-05-06
1
726 Views
Last Modified: 2013-11-28
I have a form in Access 2007 that uses a parameter query to display a record set.  In this case, based on the fields; YEAR and SCHOOL.  Each record set will normally display several hundred student records.  Within that record set, I need to find students by searching the name field.  I will generally have to update multiple records for a particular school, so the name field cannot be part of the forms parameter query.

The FIND command works wells using the any part of the field option, but it has two drawbacks.  First, after updating a record, the user has to click back into the NAME field to set the Look in: Otherwise, Look in: defaults to the last field with focus.   Second, the FIND dialog box covers much of the form and the user constantly has to move it out of the way.

There will also normally be multiple records with matching names, so there has to be a Next Record function to scroll through the matches.

If I could get the Find Look in: option to remain on the NAME field, even after clicking in a different field on the form; that would work.  Obviously, that is not the way the FIND dialog is intended to work.

Filtering is too slow and cumbersome.  

Summary:

I want a way to make the FIND command default and remain looking in the NAME field.  Or, a textbox search on the NAME field and the ability to Next Record through the matching subset of records.
0
Comment
Question by:Quig653
1 Comment
 
LVL 1

Accepted Solution

by:
Quig653 earned 0 total points
ID: 24318567
I solved the issue with a textbox and one command button using docmd.findrecord and another button using docmd.findnext.

I'll clean it up later and try to incorporate both into one button.
Private Sub Command122_Click()

On Error GoTo Err_Command122_Click
 

Dim SearchValue As String
 

SearchValue = Trim(Me.FindName)

If Len(SearchValue) > 0 Then

    DoCmd.GoToControl "Name"

    DoCmd.FindRecord SearchValue, acAnywhere, , acSearchAll, , acCurrent

    

End If
 
 

Exit_Command122_Click:

    Exit Sub
 

Err_Command122_Click:

    MsgBox Err.Description

    Resume Exit_Command122_Click

    

End Sub

Private Sub Command123_Click()

On Error GoTo Err_Command123_Click
 
 

    Screen.PreviousControl.SetFocus

    DoCmd.FindNext
 

Exit_Command123_Click:

    Exit Sub
 

Err_Command123_Click:

    MsgBox Err.Description

    Resume Exit_Command123_Click

    

End Sub

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now