Janet Lyn,
Thank you for the star!
I do like your approach. And building in the documentation means it's always available and printable, too.
Following is the On Click VBA for click-on/click-off. I position the Help window to leave as much of the original form visible as possible.
Private Sub HELP_Click()
On Error GoTo Err_HELP_Click
stDocName = "~fhlp_MISSED_PUNCH"
If SysCmd(acSysCmdGetObjectState, acForm, stDocName) <> acObjStateOpen Then
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Restore
DoCmd.MoveSize 4500, 2600
Else
DoCmd.Close acForm, stDocName
Forms!frm_Missed_PUNCH.SetFocus
Me.txtDateMissed.SetFocus
End If
Exit_HELP_Click:
Exit Sub
Err_HELP_Click:
MsgBox Err.Description
Resume Exit_HELP_Click
End Sub
Following code is inserted wherever I want to automatically close the Help window, if it is open.
'IF THE HELP WINDOW IS OPEN, CLOSE IT
stDocName = "~fhlp_MISSED_PUNCH"
If SysCmd(acSysCmdGetObjectState, acForm, stDocName) = acObjStateOpen Then
DoCmd.Close acForm, stDocName
End If