First I have a lookup form called AddressLookup. Then I have a form called Services and I also have a form called ServiceEvents.
Every Address will have a service. and for every service there is an ServiceEvent.
The user will go to the AddressLookup form and search for an address. Once the address is found (list box) the user will double click the address from the list box and on the double click event , if the customer already have a service the Service form will open and prefill with the information for that service. if not it will be in data entry mode and the user will enter a new service. This is based on the AddressID field in the Address table. AddressID is a foreign key in the Services table and the ServiceEvent table.
Afte the user completes the Service then they will click a button to complete the ServiceEvent.
If the customer already have a service, when the user clicks the ServiceEvent buttom the record for the ServiceEvent will be populated based on the AddressID.
Now the problem I'm having is....if the customer does not have a service and the user has to enter a NEW service, once the user enters the service and then clicks the ServiceEvent button the record will not populate like it did if the customer already have a service.
it's like the serviceEvent form is not recognizing the record if the user has to enter a new record.
here is the code i have that runs if the customer already have a service.
this is on the ServiceEvent Click event on the Service form.
Private Sub cmdEvent_Click()
On Error GoTo Err_cmdEvent_Click
Dim stDocName As String
Dim stLinkCriteria As String
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenForm "Service Event", , , "[AddressID] = " & Me![AddressID]
Exit_cmdEvent_Click:
Exit Sub
Err_cmdEvent_Click:
MsgBox Err.Description
Resume Exit_cmdEvent_Click
End Sub
I hope this makes sense...
Every Address will have a service. and for every service there is an ServiceEvent.
The user will go to the AddressLookup form and search for an address. Once the address is found (list box) the user will double click the address from the list box and on the double click event , if the customer already have a service the Service form will open and prefill with the information for that service. if not it will be in data entry mode and the user will enter a new service. This is based on the AddressID field in the Address table. AddressID is a foreign key in the Services table and the ServiceEvent table.
Afte the user completes the Service then they will click a button to complete the ServiceEvent.
If the customer already have a service, when the user clicks the ServiceEvent buttom the record for the ServiceEvent will be populated based on the AddressID.
Now the problem I'm having is....if the customer does not have a service and the user has to enter a NEW service, once the user enters the service and then clicks the ServiceEvent button the record will not populate like it did if the customer already have a service.
it's like the serviceEvent form is not recognizing the record if the user has to enter a new record.
here is the code i have that runs if the customer already have a service.
this is on the ServiceEvent Click event on the Service form.
Private Sub cmdEvent_Click()
On Error GoTo Err_cmdEvent_Click
Dim stDocName As String
Dim stLinkCriteria As String
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenForm "Service Event", , , "[AddressID] = " & Me![AddressID]
Exit_cmdEvent_Click:
Exit Sub
Err_cmdEvent_Click:
MsgBox Err.Description
Resume Exit_cmdEvent_Click
End Sub
I hope this makes sense...