Hello all
I am getting the following runtime error 2465 - Application-defined or Object-defined error when I run the following code.
What I want to do is change the link between the subform and form based on a field in the subform. If it is tbl_TechTime then I just want to link by the ProjectID to ProjectKey. If the field is tbl_History then I want to link by ProjectID to ProjectKey AND Status to ServiceName.
Thank you for any help you can give.
I am getting the following runtime error 2465 - Application-defined or Object-defined error when I run the following code.
Code:
Private Sub sfrm_Image_Count_Enter()
Dim rs As Recordset
Dim strSQL As String
strSQL = "SELECT * FROM tbl_Monthly_Estimate WHERE [ProjectID] = '" & Forms!frm_projectdata.ProjectKey & "' "
Set rs = CurrentDb.OpenRecordset(mySQL)
If rs!TableInformation = "tbl_TechTime" Then
Me.sfrm_Image_Count.LinkChildFields = "ProjectID"
Me.sfrm_Image_Count.LinkMasterFields = "ProjectKey"
Else
Me.sfrm_Image_Count.LinkChildFields = "ProjectID, Status"
Me.sfrm_Image_Count.LinkMasterFields = "ProjectKey, ServiceName"
End If
End Sub
What I want to do is change the link between the subform and form based on a field in the subform. If it is tbl_TechTime then I just want to link by the ProjectID to ProjectKey. If the field is tbl_History then I want to link by ProjectID to ProjectKey AND Status to ServiceName.
Thank you for any help you can give.