At last!
I got a solution to this problem, but it's not 100 % right yet.
I am using the Dlookup function for updating visibility of subform 2 when
browsing through records on the main form, and different code attached to the
checkbox for entering data/editing. Works great, except I just noticed that
there's a problem with the checkbox code - when question 99 is already
checked, and another checkbox on that continuous subform is then checked, the
target subform is made invisible.
I need to find a fix for that now, but at least I'm almost done now.
___
Private Sub Answer_AfterUpdate()
If Me.Answer = -1 And Me.QuestionID = 99 Then
Forms!frmBrowseApplications!sfrmBrowseSubmissions.Visible = True
Else: Forms!frmBrowseApplications!sfrmBrowseSubmissions.Visible = False
End If
End Sub
Private Sub Form_current()
If DLookup("[Answer]", "tblActivityAnswers", "[ActivityID] = " &
Forms!frmBrowseApplications![ActivityID] & " AND [QuestionID] = 99") = True
Then
Forms!frmBrowseApplications!sfrmBrowseSubmissions.Visible = True
End If
End Sub
Niniel said:
Oh well, maybe I shouldn't have taken your remark so seriously myself.
Anyway, thanks for continuing to look into this.
I tried using "me.sfrmSubmissions.visible=true" and I got a compile error
"method or data member not found".
If I understand you correctly, that's not surprising since the code is
stored with the subform, and not the parent form, and in that case "me" would
refer to the subform, right?
But with "frmActivityApplicationForm.sfrmSubmissions.visible= true" - which
should fit the "parentform-name.subformcontrol-name.visible=true" pattern you
outlined earlier - nothing happens when checking the checkboxes [although the
status bar does say "calculating"]; only when I uncheck them, I get an error
424 "object required".
For testing purposes I added "Me.sfrmSubmissions.Visible = False" to a
command button on the previous tab page. When the button is clicked, the
focus jumps to the next tab page and the subform is hidden. That works.
I'm
Klatuu said:
I am sorry if I offended. I was not making any comment about you or your
ability. It was only meant as a joke. IMHO the form, subform control,
subform relationship is the most confusing thing in Access. I struggle with
it every time I use it, as you can see from the error in my last post. The
form name is actually frmImportIQNavigator.
It is not uncommon for the control and the subform to have the same name.
Try this.
Me.sfrmSubmissions.Visible = True
Again, I apologize. This is never a waste of my time (my boss may
disagree), I get back from it more that I give.
:
frmActivityApplicationForm is the parent form to both of my subforms, and
sfrmSubmissions is the name of the subform I wish to unhide. According to the
property sheet the Source Object is also called sfrmSubmissions.