Hi all
I've been asked to change the way an existing form works. Originally the form was a stand alone form that was designed for bulk entry for multiple customers.
I have changed it in to a pop up sub form Training & Services that, when opened from the Customer form, displays records for a customer based on the main form. They are linked on CustomerID. I can use the record navigation buttons at the bottom of the form to look through all the records for that customer.
Code:
Private Sub Training_Serv_Click()
On Error GoTo Err_Training_Serv_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Training & Services"
stLinkCriteria = "[CustomerID]=" & "'" & Me![CustomerID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Training_Serv_Click:
Exit Sub
Err_Training_Serv_Click:
MsgBox Err.Description
Resume Exit_Training_Serv_Click
End Sub
This works fine, however when I go to enter a new record, the CustomerID field is blank and you need to select the customer before entering the new service record. This is currently a combo box.
What I would like to have the form do is only allow me enter new records for just that customer. ie. The combo box basically becomes redundant and the form wll write new records just for the customer on the main form.
What is the best way of achieving this?
BTW, I am aware of the problems with using spaces & characters in field and form names and am currently fixing this in the DB, but it's a big job.
Thanking you for your input.