I may be misunderstanding the problem there are probably two ways to do this
I am assuming you already have code to establish the presence or lack of a customer in the dbase
Place a button on the object currently being viewed (presumably an open form in Edit Mode (all customers available)
place the following code in the click event of the said button
Private Sub CmdAddCust_Click()
On Error GoTo Err_CmdAddCust_Click
'Goes directly to a new record to add customer to the table
DoCmd.GoToRecord , , acNewRec
Exit_CmdAddCust_Click:
Exit Sub
Err_CmdAddCust_Click:
MsgBox Err.Description
Resume Exit_CmdAddCust_Click
End Sub
If you wish to use an entirely different form then just add code to the button similar to the following
Private Sub CmdMMfromCust_Click()
On Error GoTo Err_CmdMMfromCust_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAddCustomer"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
DoCmd.Close acForm, "frmEditCustomers"
Exit_CmdMMfromCust_Click:
Exit Sub
Err_CmdMMfromCust_Click:
MsgBox Err.Description
Resume Exit_CmdMMfromCust_Click
End Sub
I hope I have understand the problem if not I am sure someone else on the forum will be able to assist
MF
|