WishIcouldprogram
Technical User
Brief Description:
I have a Switchboard, It opens a user friendly Form to search for Last Names (combo box) from a query *I used a query because I wanted it to continuously update info that was stored on a table *listing all the Last names generated by a table. Next I created a command button to open a Form, based on the last name where users edit, input data.
OOOps, I just realized 2 or more last names can be the same. Obviously, I need to be more specific. So I created 2 combo boxes, 1.) last name(looks up from query) and 2.) first name (looks up from query based on input from combo box 1 last name) *thank you forums*
Now I would like to take input from combo box 1 and combo box 2 and still open the same Form based on these inputs.
Using the command button wizard you are allowed to "open form and find specific data to display". However, you're only allowed one "Matching Field". I'd like LastName <-> LastName & FirstName<->FirstName.
I tried copying code I found from another forum, tailoring it to my database but when I ran it. It prompted me to Enter Parameter Value. with heading "frmSelectName.LastName" when i hit ok it then showed the info that was in the combo box for last name. hit ok again, and went to firstname... same heading "frmSelectName.FirstName", hit ok and shows info previously slected in FirstName. Hit ok again takes you to a blank Form.
Private Sub OK_Click()
On Error GoTo Err_OK_Click
Dim stDocName As String
Dim stLastName As String
Dim stFirstName As String
Dim stFilter As String
stLastName = Me.LastName.Value
stFirstName = Me.FirstName.Value
stFilter = "[frmSelectName].[LastName] = " & stLastName & " And [frmSelectName].[FirstName] = " & stFirstName
stDocName = "Representative"
DoCmd.OpenForm stDocName, , , stFilter
Exit_OK_Click:
Exit Sub
Err_OK_Click:
MsgBox Err.Description
Resume Exit_OK_Click
End Sub
Any help for a non-programmer or an easier solution would be greatly appreciated.
I have a Switchboard, It opens a user friendly Form to search for Last Names (combo box) from a query *I used a query because I wanted it to continuously update info that was stored on a table *listing all the Last names generated by a table. Next I created a command button to open a Form, based on the last name where users edit, input data.
OOOps, I just realized 2 or more last names can be the same. Obviously, I need to be more specific. So I created 2 combo boxes, 1.) last name(looks up from query) and 2.) first name (looks up from query based on input from combo box 1 last name) *thank you forums*
Now I would like to take input from combo box 1 and combo box 2 and still open the same Form based on these inputs.
Using the command button wizard you are allowed to "open form and find specific data to display". However, you're only allowed one "Matching Field". I'd like LastName <-> LastName & FirstName<->FirstName.
I tried copying code I found from another forum, tailoring it to my database but when I ran it. It prompted me to Enter Parameter Value. with heading "frmSelectName.LastName" when i hit ok it then showed the info that was in the combo box for last name. hit ok again, and went to firstname... same heading "frmSelectName.FirstName", hit ok and shows info previously slected in FirstName. Hit ok again takes you to a blank Form.
Private Sub OK_Click()
On Error GoTo Err_OK_Click
Dim stDocName As String
Dim stLastName As String
Dim stFirstName As String
Dim stFilter As String
stLastName = Me.LastName.Value
stFirstName = Me.FirstName.Value
stFilter = "[frmSelectName].[LastName] = " & stLastName & " And [frmSelectName].[FirstName] = " & stFirstName
stDocName = "Representative"
DoCmd.OpenForm stDocName, , , stFilter
Exit_OK_Click:
Exit Sub
Err_OK_Click:
MsgBox Err.Description
Resume Exit_OK_Click
End Sub
Any help for a non-programmer or an easier solution would be greatly appreciated.