If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Using specific record in continuous form for event?
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. |
#2
|
|||
|
|||
Using specific record in continuous form for event?
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" wrote: 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. |
#3
|
|||
|
|||
Using specific record in continuous form for event?
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" wrote: 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" wrote: 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. |
#4
|
|||
|
|||
Using specific record in continuous form for event?
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" wrote: 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" wrote: 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" wrote: 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. |
#5
|
|||
|
|||
Using specific record in continuous form for event?
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" wrote: 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" wrote: 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" wrote: 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" wrote: 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. |
#6
|
|||
|
|||
Using specific record in continuous form for event?
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" wrote: 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" wrote: 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" wrote: 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" wrote: 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" wrote: 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. |
#7
|
|||
|
|||
Using specific record in continuous form for event?
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" wrote: 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" wrote: 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" wrote: 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" wrote: 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" wrote: 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" wrote: 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. |
#8
|
|||
|
|||
Using specific record in continuous form for event?
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" wrote: 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" wrote: 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" wrote: 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" wrote: 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" wrote: 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" wrote: 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" wrote: 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. |
#9
|
|||
|
|||
Using specific record in continuous form for event?
First, try what I suggested.
"Niniel" wrote: 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" wrote: 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" wrote: 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" wrote: 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" wrote: 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" wrote: 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" wrote: 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" wrote: 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. |
#10
|
|||
|
|||
Using specific record in continuous form for event?
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" wrote: First, try what I suggested. "Niniel" wrote: 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" wrote: 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" wrote: 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" wrote: 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" wrote: 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" wrote: 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" wrote: 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" wrote: 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. |
Thread Tools | |
Display Modes | |
|
|