C
Colin
Hi,
I have a form with a combo box. It lists the contact
names, from another form called customers. I have tried
to create a button so that when I select the contact name
from the drop down box and click the button, it will
search for the record relating to this contact name from
the customer records.
Does anyone know how?
I have tried making a command button to open the form but
when I use it it just opens a blank version, not the one
selected in the combo box. Here is the script,
____________________
Private Sub Command2_Click()
On Error GoTo Err_Command2_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Customers"
stLinkCriteria = "[ContactName]=" & "'" & Me![Combo0]
& "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command2_Click:
Exit Sub
Err_Command2_Click:
MsgBox Err.Description
Resume Exit_Command2_Click
End Sub
__________________________
Can anyone see what is worng with this and how to fix it?
I would very much appreciate it,
Regards
Colin
I have a form with a combo box. It lists the contact
names, from another form called customers. I have tried
to create a button so that when I select the contact name
from the drop down box and click the button, it will
search for the record relating to this contact name from
the customer records.
Does anyone know how?
I have tried making a command button to open the form but
when I use it it just opens a blank version, not the one
selected in the combo box. Here is the script,
____________________
Private Sub Command2_Click()
On Error GoTo Err_Command2_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Customers"
stLinkCriteria = "[ContactName]=" & "'" & Me![Combo0]
& "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command2_Click:
Exit Sub
Err_Command2_Click:
MsgBox Err.Description
Resume Exit_Command2_Click
End Sub
__________________________
Can anyone see what is worng with this and how to fix it?
I would very much appreciate it,
Regards
Colin