Using specific record in continuous form for event?

G

Guest

Hello,

I have a continuous subform that shows 2 records consisting of a text field
and a yes/no field.
I was wondering if it was possible to take the state of one particular of
the yes/no fields to trigger an event. Specifically, when one of the
questions is checked [true] then I would like to make visible another subform
on the main form.

Can this be done, and if so, how, or should I just leave my subform visible
at all times?

Thank you.
 
G

Guest

Use the form' Current Event (that is the form that is the subform) and check
the value of the Yes/No Field

If Not Me.NewRecord And Me.YesNoControl = True Then
'Open the Subform
End If
 
G

Guest

Thank you.
I don't quite understand, however, how this works though since there are 2
check boxes in form view, and only 1 in design view - how do I make sure only
the one I want triggers the event, and not either of the two?
Maybe the code you posted already takes care of that - I haven't tried it
out yet - but just from looking at it I can't tell.
The 2 records in the first subform won't change, I pull them from a separate
table.

Klatuu said:
Use the form' Current Event (that is the form that is the subform) and check
the value of the Yes/No Field

If Not Me.NewRecord And Me.YesNoControl = True Then
'Open the Subform
End If

Niniel said:
Hello,

I have a continuous subform that shows 2 records consisting of a text field
and a yes/no field.
I was wondering if it was possible to take the state of one particular of
the yes/no fields to trigger an event. Specifically, when one of the
questions is checked [true] then I would like to make visible another subform
on the main form.

Can this be done, and if so, how, or should I just leave my subform visible
at all times?

Thank you.
 
G

Guest

If there is only one in design view, then there really is only one. The two
you are seeing are the same check box - One instance for each record. The
code I posted will affect the one that is the current record of the subform's
recordset.

Niniel said:
Thank you.
I don't quite understand, however, how this works though since there are 2
check boxes in form view, and only 1 in design view - how do I make sure only
the one I want triggers the event, and not either of the two?
Maybe the code you posted already takes care of that - I haven't tried it
out yet - but just from looking at it I can't tell.
The 2 records in the first subform won't change, I pull them from a separate
table.

Klatuu said:
Use the form' Current Event (that is the form that is the subform) and check
the value of the Yes/No Field

If Not Me.NewRecord And Me.YesNoControl = True Then
'Open the Subform
End If

Niniel said:
Hello,

I have a continuous subform that shows 2 records consisting of a text field
and a yes/no field.
I was wondering if it was possible to take the state of one particular of
the yes/no fields to trigger an event. Specifically, when one of the
questions is checked [true] then I would like to make visible another subform
on the main form.

Can this be done, and if so, how, or should I just leave my subform visible
at all times?

Thank you.
 
G

Guest

But doesn't that mean that either checkbox could be the current one? Both
checkboxes can be checked at the same time, or both can be unchecked, or
either one can be checked with the other remaining unchecked.

I'm afraid I still dont' understand, so I would be grateful if you could
explain this a bit more.

Thank you.


Klatuu said:
If there is only one in design view, then there really is only one. The two
you are seeing are the same check box - One instance for each record. The
code I posted will affect the one that is the current record of the subform's
recordset.

Niniel said:
Thank you.
I don't quite understand, however, how this works though since there are 2
check boxes in form view, and only 1 in design view - how do I make sure only
the one I want triggers the event, and not either of the two?
Maybe the code you posted already takes care of that - I haven't tried it
out yet - but just from looking at it I can't tell.
The 2 records in the first subform won't change, I pull them from a separate
table.

Klatuu said:
Use the form' Current Event (that is the form that is the subform) and check
the value of the Yes/No Field

If Not Me.NewRecord And Me.YesNoControl = True Then
'Open the Subform
End If

:

Hello,

I have a continuous subform that shows 2 records consisting of a text field
and a yes/no field.
I was wondering if it was possible to take the state of one particular of
the yes/no fields to trigger an event. Specifically, when one of the
questions is checked [true] then I would like to make visible another subform
on the main form.

Can this be done, and if so, how, or should I just leave my subform visible
at all times?

Thank you.
 
G

Guest

When you address a control in a form. The action applies to the Current
Record. (There are some exceptions for continuous and datasheet forms, but
they don't apply to this situation).
If you position on the first record and cause it's check box to be checked.
The other record's check box will not be affected. Then you move to the
other record and check it's check box. Now both are checked.
The values in the fields for one record are not affected by the values in
the fields for another record (unless you code something to cause that to
happen)

Niniel said:
But doesn't that mean that either checkbox could be the current one? Both
checkboxes can be checked at the same time, or both can be unchecked, or
either one can be checked with the other remaining unchecked.

I'm afraid I still dont' understand, so I would be grateful if you could
explain this a bit more.

Thank you.


Klatuu said:
If there is only one in design view, then there really is only one. The two
you are seeing are the same check box - One instance for each record. The
code I posted will affect the one that is the current record of the subform's
recordset.

Niniel said:
Thank you.
I don't quite understand, however, how this works though since there are 2
check boxes in form view, and only 1 in design view - how do I make sure only
the one I want triggers the event, and not either of the two?
Maybe the code you posted already takes care of that - I haven't tried it
out yet - but just from looking at it I can't tell.
The 2 records in the first subform won't change, I pull them from a separate
table.

:

Use the form' Current Event (that is the form that is the subform) and check
the value of the Yes/No Field

If Not Me.NewRecord And Me.YesNoControl = True Then
'Open the Subform
End If

:

Hello,

I have a continuous subform that shows 2 records consisting of a text field
and a yes/no field.
I was wondering if it was possible to take the state of one particular of
the yes/no fields to trigger an event. Specifically, when one of the
questions is checked [true] then I would like to make visible another subform
on the main form.

Can this be done, and if so, how, or should I just leave my subform visible
at all times?

Thank you.
 
G

Guest

My subform is a continuous form though, so maybe these exceptions do apply.
The subform displays records from a table that were created in an append
operation earlier, so I don't see which of these records could be considered
more "current" than the other.
That first table is a child table to my main parent table, and the other
subform I would like to control is based on another child table.

Does this help you understand my setup better?


Klatuu said:
When you address a control in a form. The action applies to the Current
Record. (There are some exceptions for continuous and datasheet forms, but
they don't apply to this situation).
If you position on the first record and cause it's check box to be checked.
The other record's check box will not be affected. Then you move to the
other record and check it's check box. Now both are checked.
The values in the fields for one record are not affected by the values in
the fields for another record (unless you code something to cause that to
happen)

Niniel said:
But doesn't that mean that either checkbox could be the current one? Both
checkboxes can be checked at the same time, or both can be unchecked, or
either one can be checked with the other remaining unchecked.

I'm afraid I still dont' understand, so I would be grateful if you could
explain this a bit more.

Thank you.


Klatuu said:
If there is only one in design view, then there really is only one. The two
you are seeing are the same check box - One instance for each record. The
code I posted will affect the one that is the current record of the subform's
recordset.

:

Thank you.
I don't quite understand, however, how this works though since there are 2
check boxes in form view, and only 1 in design view - how do I make sure only
the one I want triggers the event, and not either of the two?
Maybe the code you posted already takes care of that - I haven't tried it
out yet - but just from looking at it I can't tell.
The 2 records in the first subform won't change, I pull them from a separate
table.

:

Use the form' Current Event (that is the form that is the subform) and check
the value of the Yes/No Field

If Not Me.NewRecord And Me.YesNoControl = True Then
'Open the Subform
End If

:

Hello,

I have a continuous subform that shows 2 records consisting of a text field
and a yes/no field.
I was wondering if it was possible to take the state of one particular of
the yes/no fields to trigger an event. Specifically, when one of the
questions is checked [true] then I would like to make visible another subform
on the main form.

Can this be done, and if so, how, or should I just leave my subform visible
at all times?

Thank you.
 
G

Guest

Hm, maybe I can do something like this:

Look up current [parent] record id, and if QuestionID x for that record ID
is true, then make subform2 visible.

How would that have to be coded?
This is probably totally wrong:

if [Forms]![frmActivityApplicationForm]![ActivityID] and
tblActivityAnswers.QuestionID(99) = true then
subform2.visible = true
else subform2.visible = false [is an else statement always required?]
end if

Niniel said:
My subform is a continuous form though, so maybe these exceptions do apply.
The subform displays records from a table that were created in an append
operation earlier, so I don't see which of these records could be considered
more "current" than the other.
That first table is a child table to my main parent table, and the other
subform I would like to control is based on another child table.

Does this help you understand my setup better?


Klatuu said:
When you address a control in a form. The action applies to the Current
Record. (There are some exceptions for continuous and datasheet forms, but
they don't apply to this situation).
If you position on the first record and cause it's check box to be checked.
The other record's check box will not be affected. Then you move to the
other record and check it's check box. Now both are checked.
The values in the fields for one record are not affected by the values in
the fields for another record (unless you code something to cause that to
happen)

Niniel said:
But doesn't that mean that either checkbox could be the current one? Both
checkboxes can be checked at the same time, or both can be unchecked, or
either one can be checked with the other remaining unchecked.

I'm afraid I still dont' understand, so I would be grateful if you could
explain this a bit more.

Thank you.


:

If there is only one in design view, then there really is only one. The two
you are seeing are the same check box - One instance for each record. The
code I posted will affect the one that is the current record of the subform's
recordset.

:

Thank you.
I don't quite understand, however, how this works though since there are 2
check boxes in form view, and only 1 in design view - how do I make sure only
the one I want triggers the event, and not either of the two?
Maybe the code you posted already takes care of that - I haven't tried it
out yet - but just from looking at it I can't tell.
The 2 records in the first subform won't change, I pull them from a separate
table.

:

Use the form' Current Event (that is the form that is the subform) and check
the value of the Yes/No Field

If Not Me.NewRecord And Me.YesNoControl = True Then
'Open the Subform
End If

:

Hello,

I have a continuous subform that shows 2 records consisting of a text field
and a yes/no field.
I was wondering if it was possible to take the state of one particular of
the yes/no fields to trigger an event. Specifically, when one of the
questions is checked [true] then I would like to make visible another subform
on the main form.

Can this be done, and if so, how, or should I just leave my subform visible
at all times?

Thank you.
 
G

Guest

First, try what I suggested.

Niniel said:
Hm, maybe I can do something like this:

Look up current [parent] record id, and if QuestionID x for that record ID
is true, then make subform2 visible.

How would that have to be coded?
This is probably totally wrong:

if [Forms]![frmActivityApplicationForm]![ActivityID] and
tblActivityAnswers.QuestionID(99) = true then
subform2.visible = true
else subform2.visible = false [is an else statement always required?]
end if

Niniel said:
My subform is a continuous form though, so maybe these exceptions do apply.
The subform displays records from a table that were created in an append
operation earlier, so I don't see which of these records could be considered
more "current" than the other.
That first table is a child table to my main parent table, and the other
subform I would like to control is based on another child table.

Does this help you understand my setup better?


Klatuu said:
When you address a control in a form. The action applies to the Current
Record. (There are some exceptions for continuous and datasheet forms, but
they don't apply to this situation).
If you position on the first record and cause it's check box to be checked.
The other record's check box will not be affected. Then you move to the
other record and check it's check box. Now both are checked.
The values in the fields for one record are not affected by the values in
the fields for another record (unless you code something to cause that to
happen)

:

But doesn't that mean that either checkbox could be the current one? Both
checkboxes can be checked at the same time, or both can be unchecked, or
either one can be checked with the other remaining unchecked.

I'm afraid I still dont' understand, so I would be grateful if you could
explain this a bit more.

Thank you.


:

If there is only one in design view, then there really is only one. The two
you are seeing are the same check box - One instance for each record. The
code I posted will affect the one that is the current record of the subform's
recordset.

:

Thank you.
I don't quite understand, however, how this works though since there are 2
check boxes in form view, and only 1 in design view - how do I make sure only
the one I want triggers the event, and not either of the two?
Maybe the code you posted already takes care of that - I haven't tried it
out yet - but just from looking at it I can't tell.
The 2 records in the first subform won't change, I pull them from a separate
table.

:

Use the form' Current Event (that is the form that is the subform) and check
the value of the Yes/No Field

If Not Me.NewRecord And Me.YesNoControl = True Then
'Open the Subform
End If

:

Hello,

I have a continuous subform that shows 2 records consisting of a text field
and a yes/no field.
I was wondering if it was possible to take the state of one particular of
the yes/no fields to trigger an event. Specifically, when one of the
questions is checked [true] then I would like to make visible another subform
on the main form.

Can this be done, and if so, how, or should I just leave my subform visible
at all times?

Thank you.
 
G

Guest

Ok.
How do I reference the other subform?

Like this?

If Not Me.NewRecord And Me.Answer = True Then
frmActivityApplicationForm.sfrmSubmissions.Visible = True
End If

That's not making the subform visible though, so maybe I am referencing it
the wrong way.

Klatuu said:
First, try what I suggested.

Niniel said:
Hm, maybe I can do something like this:

Look up current [parent] record id, and if QuestionID x for that record ID
is true, then make subform2 visible.

How would that have to be coded?
This is probably totally wrong:

if [Forms]![frmActivityApplicationForm]![ActivityID] and
tblActivityAnswers.QuestionID(99) = true then
subform2.visible = true
else subform2.visible = false [is an else statement always required?]
end if

Niniel said:
My subform is a continuous form though, so maybe these exceptions do apply.
The subform displays records from a table that were created in an append
operation earlier, so I don't see which of these records could be considered
more "current" than the other.
That first table is a child table to my main parent table, and the other
subform I would like to control is based on another child table.

Does this help you understand my setup better?


:

When you address a control in a form. The action applies to the Current
Record. (There are some exceptions for continuous and datasheet forms, but
they don't apply to this situation).
If you position on the first record and cause it's check box to be checked.
The other record's check box will not be affected. Then you move to the
other record and check it's check box. Now both are checked.
The values in the fields for one record are not affected by the values in
the fields for another record (unless you code something to cause that to
happen)

:

But doesn't that mean that either checkbox could be the current one? Both
checkboxes can be checked at the same time, or both can be unchecked, or
either one can be checked with the other remaining unchecked.

I'm afraid I still dont' understand, so I would be grateful if you could
explain this a bit more.

Thank you.


:

If there is only one in design view, then there really is only one. The two
you are seeing are the same check box - One instance for each record. The
code I posted will affect the one that is the current record of the subform's
recordset.

:

Thank you.
I don't quite understand, however, how this works though since there are 2
check boxes in form view, and only 1 in design view - how do I make sure only
the one I want triggers the event, and not either of the two?
Maybe the code you posted already takes care of that - I haven't tried it
out yet - but just from looking at it I can't tell.
The 2 records in the first subform won't change, I pull them from a separate
table.

:

Use the form' Current Event (that is the form that is the subform) and check
the value of the Yes/No Field

If Not Me.NewRecord And Me.YesNoControl = True Then
'Open the Subform
End If

:

Hello,

I have a continuous subform that shows 2 records consisting of a text field
and a yes/no field.
I was wondering if it was possible to take the state of one particular of
the yes/no fields to trigger an event. Specifically, when one of the
questions is checked [true] then I would like to make visible another subform
on the main form.

Can this be done, and if so, how, or should I just leave my subform visible
at all times?

Thank you.
 
G

Guest

frmActivityApplicationForm.sfrmSubmissions.Visible = True

I don't know which objects you are referencing in the line above, but the
common confusion is between the subform control and the subform. The subform
is just another form embedded in the parent form. The subform control is a
control on the parent form. It attaches the subform throught its Source
Object property. You don't make the subform visible or not visible, but the
subform control.

So, the syntax is

ParentFormName!SubFormControlName.Visible = True

Here is an example from a form I happen to be working on at the moment:

Me.fsubImportIQNavigator.Visible = True

Me is the parent form (Normal use of me if you are working in the parent form)
Its name is frmIQNavigatorValidate

fsubImportIQNavigator is a SubForm control on the form frmIQNavigatorValidate

frmIQNavigatorValidate is the sub form that is the Source Object for the
control fsubImportIQNavigator

Notice the subform is not referenced in the above statement at all.

I am confident the above either cleared this up for you or so confused you
that you have decided to give up programming and get a job either selling
shoes or digging holes in the road.

Niniel said:
Ok.
How do I reference the other subform?

Like this?

If Not Me.NewRecord And Me.Answer = True Then
frmActivityApplicationForm.sfrmSubmissions.Visible = True
End If

That's not making the subform visible though, so maybe I am referencing it
the wrong way.

Klatuu said:
First, try what I suggested.

Niniel said:
Hm, maybe I can do something like this:

Look up current [parent] record id, and if QuestionID x for that record ID
is true, then make subform2 visible.

How would that have to be coded?
This is probably totally wrong:

if [Forms]![frmActivityApplicationForm]![ActivityID] and
tblActivityAnswers.QuestionID(99) = true then
subform2.visible = true
else subform2.visible = false [is an else statement always required?]
end if

:

My subform is a continuous form though, so maybe these exceptions do apply.
The subform displays records from a table that were created in an append
operation earlier, so I don't see which of these records could be considered
more "current" than the other.
That first table is a child table to my main parent table, and the other
subform I would like to control is based on another child table.

Does this help you understand my setup better?


:

When you address a control in a form. The action applies to the Current
Record. (There are some exceptions for continuous and datasheet forms, but
they don't apply to this situation).
If you position on the first record and cause it's check box to be checked.
The other record's check box will not be affected. Then you move to the
other record and check it's check box. Now both are checked.
The values in the fields for one record are not affected by the values in
the fields for another record (unless you code something to cause that to
happen)

:

But doesn't that mean that either checkbox could be the current one? Both
checkboxes can be checked at the same time, or both can be unchecked, or
either one can be checked with the other remaining unchecked.

I'm afraid I still dont' understand, so I would be grateful if you could
explain this a bit more.

Thank you.


:

If there is only one in design view, then there really is only one. The two
you are seeing are the same check box - One instance for each record. The
code I posted will affect the one that is the current record of the subform's
recordset.

:

Thank you.
I don't quite understand, however, how this works though since there are 2
check boxes in form view, and only 1 in design view - how do I make sure only
the one I want triggers the event, and not either of the two?
Maybe the code you posted already takes care of that - I haven't tried it
out yet - but just from looking at it I can't tell.
The 2 records in the first subform won't change, I pull them from a separate
table.

:

Use the form' Current Event (that is the form that is the subform) and check
the value of the Yes/No Field

If Not Me.NewRecord And Me.YesNoControl = True Then
'Open the Subform
End If

:

Hello,

I have a continuous subform that shows 2 records consisting of a text field
and a yes/no field.
I was wondering if it was possible to take the state of one particular of
the yes/no fields to trigger an event. Specifically, when one of the
questions is checked [true] then I would like to make visible another subform
on the main form.

Can this be done, and if so, how, or should I just leave my subform visible
at all times?

Thank you.
 
G

Guest

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.

And yes, your post was confusing because you said that
frmIQNavigatorValidate is both the parent form and the subform:
Me is the parent form (Normal use of me if you are working in the parent form)
Its name is frmIQNavigatorValidate
frmIQNavigatorValidate is the sub form that is the Source Object for the
control fsubImportIQNavigator

Since according to your subtle hint this establishes that I should be doing
other things rather than wasting your time here, I would like to say how
sorry I am for wasting your time, and thank you for your efforts.
Please feel free to ignore any posts I may make in the future.
 
G

Guest

I am so sorry, I did not mean that at all. It was just a joke. What I meant
was that the relationship between the form, the subform control, and the
subform is very confusing and, IMHO the hardest to keep straight. I have
been working with Access since 1999 and still have trouble keeping it
straigt. I was not at all trying to make any negative comments about you or
your ability.

As you see, I even made a mistake when I was trying to explain it. The
actual name is frmImportIQNavigator.

It is not uncommon for the control and the form to have the same name. I
think Access sort of lets that happen. I took up the habit of not naming
them the same to help me keep them straight. Try this and see if it works
for you:

Me.sfrmSubmissions.Visible = True

You are not wasting my time. I am always happy to help and often have
question I need help with.

Again, my sincre apologies and I hope to see you posting here regularly.
 
G

Guest

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.
 
G

Guest

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
 
G

Guest

Sorry if I'm getting a little lost here. Going back to the original post, it
is you are in one subform and if you check a check box, you want a different
subform to be visible and not visible if you uncheck it. What we need to do
is reference the parent so we can get a reference to the other subform. I
don't know if this will do it or not, but give it a try.

Me.Parent!OtherSubformName.Visible = True

If some version of that doesn't do it, let me know and I will see if I can
set up a test environment to figure it out.
 
G

Guest

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.
 
G

Guest

Good

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

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.
 
G

Guest

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

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.
 

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

Top