Hello,
I'm very new to VBA programming, so this is my first attempt at creating a interactive (with forms) database. I have a database of a few thousand records, containing first name, last name, city, state, and phone numbers.
What I'd like to do is have the user enter the First Name into a text box and then the FIRSTNAME column is filtered by that value, thereby searching the database for all records with that first name.
Now the first time I open the database and click the button that triggers the code it pops up a window that says "parameter value?" for the name I've entered into the text box.
Any ideas? Thank you so much.
Here is the code I have:
Private Sub Find_Click()
On Error GoTo Err_Find_Click
Dim strName As String
strName = ""
Me.first.SetFoc us
strName = first.Text
DoCmd.ApplyFilt er , "FIRSTNAME = " & strName
Me.first.SetFoc us
Exit_Find_Click :
Exit Sub
Err_Find_Click:
MsgBox Err.Description
Resume Exit_Find_Click
End Sub
*Note: "first" is the name of the text box
I'm very new to VBA programming, so this is my first attempt at creating a interactive (with forms) database. I have a database of a few thousand records, containing first name, last name, city, state, and phone numbers.
What I'd like to do is have the user enter the First Name into a text box and then the FIRSTNAME column is filtered by that value, thereby searching the database for all records with that first name.
Now the first time I open the database and click the button that triggers the code it pops up a window that says "parameter value?" for the name I've entered into the text box.
Any ideas? Thank you so much.
Here is the code I have:
Private Sub Find_Click()
On Error GoTo Err_Find_Click
Dim strName As String
strName = ""
Me.first.SetFoc us
strName = first.Text
DoCmd.ApplyFilt er , "FIRSTNAME = " & strName
Me.first.SetFoc us
Exit_Find_Click :
Exit Sub
Err_Find_Click:
MsgBox Err.Description
Resume Exit_Find_Click
End Sub
*Note: "first" is the name of the text box
Comment