Hello,
I've made a complex sub form configuration (please see the attached image).
I have a series of sub-sub-forms with buttons next to each record. When the button is pressed I would like to query another subform "Reportable comments". How do I correctly refer to that subform from a button code of a sub-sub form?
I've tried several ways but Access can't find the object. The query is correct but the reference to the reportable comments subform is wrong.
I have seen the following website, http://access.mvps.org/access/forms/frm0031.htm
however, still can get this to work. Thanks, Mila
I've made a complex sub form configuration (please see the attached image).
I have a series of sub-sub-forms with buttons next to each record. When the button is pressed I would like to query another subform "Reportable comments". How do I correctly refer to that subform from a button code of a sub-sub form?
I've tried several ways but Access can't find the object. The query is correct but the reference to the reportable comments subform is wrong.
I have seen the following website, http://access.mvps.org/access/forms/frm0031.htm
however, still can get this to work. Thanks, Mila
Code:
Private Sub cmb_info_Click()
Dim temp_rst1 As Recordset
Dim Db As Database
Dim qry As String
If Nz(Me.ID) <> "" Then
Set Db = CurrentDb
qry = "SELECT cnv_id, CreatedDate, LastReviewed, CreatedBy, CommentTxt, Interpretation FROM tbl_cnv_reportable_comments " & _
"WHERE cnv_id = '" & Me.cnv_id & "'"
Debug.Print qry
Set temp_rst1 = Db.OpenRecordset(qry)
'[Forms]![frm_combined_CNVs_with_Comments]![frm_cnv_reportable_comments].[Form].RecordSource.Requery
'Me.Parent.Parent.[Form]![frm_cnv_reportable_comments].[Form].RecordSource.Requery
'[Forms]![frm_combined_CNVs_with_Comments]![frm_cnv_reportable_comments].[Form].RecordSource = qry
'[Forms]![frm_combined_CNVs_with_Comments]![frm_cnv_reportable_comments].[Form].RecordSource.Requery
If temp_rst1.EOF Then 'emty record set
[Forms]![frm_combined_CNVs_with_Comments]![frm_cnv_reportable_comments].[Form]![txt_cnv_id] = Me.cnv_id 'copy down id
End If
End If
End Sub