Using specific record in continuous form for event?

  • Thread starter Thread starter Guest
  • Start date Start date
"Answer" is the checkbox on my subform in case of the AfterUpdate event; in
case of the Current event, it's the name of the column in the
tblActivityAnswers table that stores the state of the yes/no fields.

Klatuu said:
I don't see it here, what is Answer?

Niniel said:
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

:

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.
 
Could it be this line?
If Me.Answer = -1 And Me.QuestionID = 99 Then
Forms!frmBrowseApplications!sfrmBrowseSubmissions.Visible = True
Else: Forms!frmBrowseApplications!sfrmBrowseSubmissions.Visible = False

Niniel said:
"Answer" is the checkbox on my subform in case of the AfterUpdate event; in
case of the Current event, it's the name of the column in the
tblActivityAnswers table that stores the state of the yes/no fields.

Klatuu said:
I don't see it here, what is Answer?

Niniel said:
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

:

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

:

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.
 
Maybe, although don't see why the target subform would become invisible again
when you check another checkbox. Checking any checkbox should just set
Me.Answer to -1 again, shouldn't it?
Hm, maybe it's because question 99 is not linked to that other checkbox so
the else statement kicks in.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top