S
SusanV
I have a main form (frmPMOReportData) with several subforms on it. One of
the subforms, subfrmRepVessels, is a list of the vessels the report pertains
to, using bound checkbox controls (Included).
There's also an unbound checkbox control (chkAll) in the subform's form
header for selecting all vessels. Everything is working, but I would like to
add a confirmation to save changes to the included vessel list when the
focus changes from the vessel subform back to the main form or any other
subform, as users don't seem to notice when they accidentally click on a box
and change it. (I can't set the checkboxes to locked after update until the
report is final, as the scope of reports often changes while in progress)
I *think* I need to use the subforms unload event?
Here's the code for the subform (without the confirmation box code):
---------------------------------
Private Sub chkAll_AfterUpdate()
'turn warnings off
DoCmd.SetWarnings False
'mark all vessels as included
Dim r As String
r = Me!RepNum
If Me!chkAll = True Then
DoCmd.RunSQL "UPDATE tblRepVessels " _
& "SET tblRepVessels.Included = True " _
& "WHERE tblRepVessels.RepNum =" & "'" & r & "'"
End If
'turn warnings back on
DoCmd.SetWarnings True
'Refresh form view
Me.Repaint
End Sub
---------------------------------
Private Sub Included_AfterUpdate()
If Me!Included = False Then
Me!chkAll = False
End If
Me.Repaint
End Sub
---------------------------------
the subforms, subfrmRepVessels, is a list of the vessels the report pertains
to, using bound checkbox controls (Included).
There's also an unbound checkbox control (chkAll) in the subform's form
header for selecting all vessels. Everything is working, but I would like to
add a confirmation to save changes to the included vessel list when the
focus changes from the vessel subform back to the main form or any other
subform, as users don't seem to notice when they accidentally click on a box
and change it. (I can't set the checkboxes to locked after update until the
report is final, as the scope of reports often changes while in progress)
I *think* I need to use the subforms unload event?
Here's the code for the subform (without the confirmation box code):
---------------------------------
Private Sub chkAll_AfterUpdate()
'turn warnings off
DoCmd.SetWarnings False
'mark all vessels as included
Dim r As String
r = Me!RepNum
If Me!chkAll = True Then
DoCmd.RunSQL "UPDATE tblRepVessels " _
& "SET tblRepVessels.Included = True " _
& "WHERE tblRepVessels.RepNum =" & "'" & r & "'"
End If
'turn warnings back on
DoCmd.SetWarnings True
'Refresh form view
Me.Repaint
End Sub
---------------------------------
Private Sub Included_AfterUpdate()
If Me!Included = False Then
Me!chkAll = False
End If
Me.Repaint
End Sub
---------------------------------