I have a table called Invoice Details and another called Customer Details. In the form for Invoice Details I have a combo box that reads the customer's name from the Customer Details Table. If the customer name doesn't exist I have an "Add New Customer" button. When it is clicked the Customer Details form is opened (and the Invoice Details form is hidden) to allow the user to add in a new customer. When the Customer Details form is closed the Invoice Details form reappears. Clicking on the combo box will now reveal the new customer as part of the drop down list and the user can carry on completing the Invoice form. A great tool.
However, if you want to edit the customer details form directly, it opens up the Invoice details form as well. I need to find a way to stop this from happening - ie only when the customer details form is opened directly (not from within the Invoice details form using the Add New Customer button.
The code is here as others may find it useful as well:
Private Sub Add_New_Customer_Click()
On Error GoTo Err_Add_New_Customer_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frm_Customer_Details"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Add_New_Customer_Click:
Exit Sub
Err_Add_New_Customer_Click:
MsgBox Err.Description
Resume Exit_Add_New_Customer_Click
Me.Refresh
End Sub
However, if you want to edit the customer details form directly, it opens up the Invoice details form as well. I need to find a way to stop this from happening - ie only when the customer details form is opened directly (not from within the Invoice details form using the Add New Customer button.
The code is here as others may find it useful as well:
Private Sub Add_New_Customer_Click()
On Error GoTo Err_Add_New_Customer_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frm_Customer_Details"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Add_New_Customer_Click:
Exit Sub
Err_Add_New_Customer_Click:
MsgBox Err.Description
Resume Exit_Add_New_Customer_Click
Me.Refresh
End Sub