Hi folks,
I have a form called frmCustomerList; allowing a user to search and find a customer. When a user finds a customer, there are two buttons, one opens an edit customer form, called frmEditCompany through the following code
This works fine.
However, I have/need another button next to it that opens another form called frmSaleEntry and starts a sale for the selected company.
this form has combo box (cboCompanyName) which allows the user to select the company in question. This forms works fine normally, but I want this field pre-populated when you link to it via frmCustomerList and the above code method doesn't cut it. cboCompanyName pulls down a list of companies with data from a table called tblCustomers, field name CompanyName.
Any clues on how to open a form and pre-populate this combo.
Many thanks!!!
I have a form called frmCustomerList; allowing a user to search and find a customer. When a user finds a customer, there are two buttons, one opens an edit customer form, called frmEditCompany through the following code
Code:
Private Sub butEdit_Click()
On Error GoTo Err_butEdit_Click
Dim stDocName As String
Dim stLinkCriteria As String
stLinkCriteria = "CustomerID = '" & Me.CustomerID.Value & "'"
stDocName = "frmEditCompany"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_butEdit_Click:
Exit Sub
Err_butEdit_Click:
MsgBox Err.Description
Resume Exit_butEdit_Click
End Sub
This works fine.
However, I have/need another button next to it that opens another form called frmSaleEntry and starts a sale for the selected company.
this form has combo box (cboCompanyName) which allows the user to select the company in question. This forms works fine normally, but I want this field pre-populated when you link to it via frmCustomerList and the above code method doesn't cut it. cboCompanyName pulls down a list of companies with data from a table called tblCustomers, field name CompanyName.
Any clues on how to open a form and pre-populate this combo.
Many thanks!!!