J
JohnLute
I'm trying to code a combo box to open a form. Here's my code:
Private Sub cbSupplierContact_DblClick(Cancel As Integer)
If IsNull(Me!cbSupplierContact) Then
' no supplier contact selected; show all ...
DoCmd.OpenForm "frmPKSuppliers", _
WhereCondition:="txtName='" & Me!cbSupplierContact.Column(5) & "'"
Else
' show selected supplier contact ...
DoCmd.OpenForm "frmPKSuppliers", _
WhereCondition:="txtName='" & Me!cbSupplierContact.Column(5) & "'"
End If
End Sub
RowSource:
SELECT tblSupplierContacts.FirstName, tblSupplierContacts.LastName, tblSupplierContacts.Title, tblSupplierContacts.WorkPhone, tblSupplierContacts.numContactID, tblSupplierNames.txtName FROM tblSupplierNames INNER JOIN tblSupplierContacts ON tblSupplierNames.txtName=tblSupplierContacts.txtName ORDER BY tblSupplierContacts.FirstName;
How can I change this so that frmPKSuppliers opens and also filters for the selected tblSupplierContacts.numContactID in column 5?
THANKS!!!
Private Sub cbSupplierContact_DblClick(Cancel As Integer)
If IsNull(Me!cbSupplierContact) Then
' no supplier contact selected; show all ...
DoCmd.OpenForm "frmPKSuppliers", _
WhereCondition:="txtName='" & Me!cbSupplierContact.Column(5) & "'"
Else
' show selected supplier contact ...
DoCmd.OpenForm "frmPKSuppliers", _
WhereCondition:="txtName='" & Me!cbSupplierContact.Column(5) & "'"
End If
End Sub
RowSource:
SELECT tblSupplierContacts.FirstName, tblSupplierContacts.LastName, tblSupplierContacts.Title, tblSupplierContacts.WorkPhone, tblSupplierContacts.numContactID, tblSupplierNames.txtName FROM tblSupplierNames INNER JOIN tblSupplierContacts ON tblSupplierNames.txtName=tblSupplierContacts.txtName ORDER BY tblSupplierContacts.FirstName;
How can I change this so that frmPKSuppliers opens and also filters for the selected tblSupplierContacts.numContactID in column 5?
THANKS!!!