Hi
I have used some code, found here I believe, to create a Find dialog box or input box to make finding a record as quickly as possible when a client telephones or if I need to find a particular record quickly
The code is
Private Sub cmdFind_Click()
'Search for Specific LastName in the "Last Name" field
On Error GoTo Err_Find_Click
Dim strLen, i As Integer
Dim strTempName, strSearchName As String
strLen = Len(strSearchName)
DoCmd.GoToControl "LastName"
strSearchName = InputBox("Enter any part of the last name.", "Look Up Last Name")
DoCmd.FindRecord strSearchName, acAnywhere, , acSearchAll, , acCurrent, True
DoCmd.RunCommand acCmdFind
Exit_Find_Click:
Exit Sub
Err_Find_Click:
[LastName].SetFocus
'MsgBox "Cancelled"
'Resume Exit_Find_Click
End Sub
This works quite nicely but:
1. When it has found the first record it closes the inbox and leaves the MS Access Find and Replace dialog box on the screen.
Does anybody know how I can prevent this? ie when the search has found the first record it closes the input box and box and sets focus on a particular field Notes: this is a simple text box for "scribbling" notes down on to quickly say during a phone call.
Thanks
Jpur
I have used some code, found here I believe, to create a Find dialog box or input box to make finding a record as quickly as possible when a client telephones or if I need to find a particular record quickly
The code is
Private Sub cmdFind_Click()
'Search for Specific LastName in the "Last Name" field
On Error GoTo Err_Find_Click
Dim strLen, i As Integer
Dim strTempName, strSearchName As String
strLen = Len(strSearchName)
DoCmd.GoToControl "LastName"
strSearchName = InputBox("Enter any part of the last name.", "Look Up Last Name")
DoCmd.FindRecord strSearchName, acAnywhere, , acSearchAll, , acCurrent, True
DoCmd.RunCommand acCmdFind
Exit_Find_Click:
Exit Sub
Err_Find_Click:
[LastName].SetFocus
'MsgBox "Cancelled"
'Resume Exit_Find_Click
End Sub
This works quite nicely but:
1. When it has found the first record it closes the inbox and leaves the MS Access Find and Replace dialog box on the screen.
Does anybody know how I can prevent this? ie when the search has found the first record it closes the input box and box and sets focus on a particular field Notes: this is a simple text box for "scribbling" notes down on to quickly say during a phone call.
Thanks
Jpur