I have a supplier form (frmsuppliers) where I add the information for new suppliers, I want users to be able to click on a button to open the contacts form frmcontacts in add mode with the name of the supplier that was shown automatically shown on the screen. The following code opens the form with the correct supplier showing, but the form shows the existing records and when I either click the add button, the supplier id stops showing the correct supplier.
I want to avoid users having to type in this information, how can I change the code to open in add mode as everyway I have tried this it seems to still retain the connection, but the supplier Id is not automatically populated. Any help gratefully received.
I want to avoid users having to type in this information, how can I change the code to open in add mode as everyway I have tried this it seems to still retain the connection, but the supplier Id is not automatically populated. Any help gratefully received.
Code:
Private Sub AddNewContact_Click()
If IsNull(Me.SupplierID) Then Exit Sub
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenForm "frmcontacts", acNormal, , "[SupplierID]=" & Me.SupplierID
End Sub
[\code]