I need help. I've confused myself with all of the things I've tried.
I'm trying to modify the exiting Contacts template in Access 2000 to
include a search option. To the Contact Entry form I've added an
unbound text field with lable and a command button. The following code
is in the On Click event of the Command button.
Private Sub Button197_Click()
On Error GoTo Err_Button197_Click
Dim strWhere As String
If Not IsNull(Me.TxtSearch) Then
strWhere = "LastName = " & Me.TxtSearch
End If
DoCmd.OpenForm "Contacts", , , strWhere
rem Err_Button197_Click:
rem MsgBox "Error finding record: " & Error$
Rem RetVal = False
Rem Resume Next
Rem MsgBox Error$
Rem Resume Exit_Button197_Click
Exit_Button197_Click:
Exit Sub
End Sub
When I enter the name and click, I get a popup titled "Enter Parameter
Value" with an entry field entry field. If I enter the text in this
field, the form shows the record I'm looking for. So, it works, sort
of. Why am I getting the popup? How do I get rid of it?
Also, I'd like to have the other records available. Right now, it
just pulls up the record I'm looking for. To view the other records I
have to click the Remove Filter button on the toolbar.
While you're educating me, I don't really understand what the &
Me.TxtSearch part of the where statement does.
Thanks in advance for any help.
Dave