scouser
Registered User.
- Local time
- Today, 06:10
- Joined
- Nov 25, 2003
- Messages
- 767
Hi Guys. I have a form 'frmPurchaseOrders'. The user selects a Supplier from a combo. The form contains a control 'ContactID'. I want the user to be able to add a new Supplier Contact. I have added a cmd 'cmdNewContact'. When clicked I want the Supplier form to open on the relevant supplier. I added this code to the cmd:
frmSuppliers opens but not on the desired record (where supplier id equals the suppliers id of the purchase orders form).
Any ideas?
Cheers,
Phil.
Code:
On Error GoTo Err_cmdNewContact_Click
Dim strDocName As String
strDocName = "frmSuppliers"
DoCmd.OpenForm strDocName, , , [SupplierID] = [Forms]![frmPurchaseOrders]![tblSuppliers.SupplierID] 'I have 2 supplier ID's on the form
DoCmd.Close acForm, "frmPurchaseOrders"
' Give CompanyName control focus.
Forms![frmSuppliers]!CompanyName.SetFocus
Exit_cmdNewContact_Click:
Exit Sub
Err_cmdNewContact_Click:
MsgBox Err.Description
Resume Exit_cmdNewContact_Click
frmSuppliers opens but not on the desired record (where supplier id equals the suppliers id of the purchase orders form).
Any ideas?
Cheers,
Phil.