Just on load. The code for the form is below. The stuff in bold is what's on the On Load.
Code:
Option Compare Database
Private Sub Combo13_AfterUpdate()
Hold.SetFocus
If Combo13 = 12 Then
Combo30 = 3
End If
If Combo13 = 42 Or Combo13 = 47 Or Combo13 = 68 Then
Reason.SetFocus
End If
End Sub
Private Sub Combo13_GotFocus()
Me.Combo13.Dropdown
End Sub
Private Sub Combo17_AfterUpdate()
[AbsentDate] = Forms![SelectAbsenceDate]![AbsenceDate]
'DoCmd.OpenQuery "Populate Employee Defaults on Absence Form", acViewNormal, acEdit
'I did not use the above query here for employee defaults. I used Me.Combo17 procedures.
'I used DoCmd.OpenQuery "Populate LTA Employee Defaults on Absence Form", acViewNormal, acEdit when
'adding LTA employees from the other form.
Me.OccupationCode = Me.Combo17.Column(4)
Me.OccupationDescription = Me.Combo17.Column(5)
Me.DefOccupationCode = Me.Combo17.Column(4)
Me.Refresh
Hold.SetFocus
End Sub
Private Sub Combo17_GotFocus()
Me.Combo17.Dropdown
End Sub
Private Sub Combo30_GotFocus()
Me.Combo30.Dropdown
End Sub
Private Sub Combo37_AfterUpdate()
If [DefOccupationCode] = [OccupationCode] Then
[Override] = False
Else
[Override] = True
End If
Me.Refresh
'DoCmd.OpenQuery "Update Absence OccupationDescription", acViewNormal, acEdit
Me.OccupationDescription = Me.Combo37.Column(1)
Hold.SetFocus
End Sub
Private Sub Combo37_GotFocus()
Me.Combo37.Dropdown
End Sub
Private Sub Command43_Click()
DoCmd.OpenReport "Absent Hours from Absence Form", acViewReport, "", "", acNormal
End Sub
Private Sub Command45_Click()
Call DeleteRecordsMissingCodeCheck
DoCmd.Requery
DoCmd.OpenQuery "Append to MissingCodeCheck"
Call CheckForMissingCode("MissingCodeCheck", "EarningsCode")
If boolMissingCode = True Then
MsgBox "An Earnings Code must be entered for every employee!"
Hold.SetFocus
Else
Hold.SetFocus
Command45.Enabled = False
DoCmd.OpenForm "AbsentForm Signoff", acNormal, "", "", acAdd, acNormal
End If
End Sub
Private Sub Command51_Click()
DoCmd.OpenForm "Message Form Add All For Stat Holiday"
End Sub
'------------------------------------------------------------
' Form_Load
'
'------------------------------------------------------------
Private Sub Form_Load()
On Error GoTo Form_Load_Err
If boolAbsentFormSigned = True Then
Command45.Enabled = False
End If
[Text48] = strAbsentFormSignedUser + " " + strAbsentFormSignedDateTime
DoCmd.GoToControl "Hold"
If strPermissionLevel = 5 _
Or strPermissionLevel = 6 _
Then
Command43.Visible = True
End If
Form_Load_Exit:
Exit Sub
Form_Load_Err:
MsgBox Error$
Resume Form_Load_Exit
End Sub
'------------------------------------------------------------
' Reason_AfterUpdate
'
'------------------------------------------------------------
Private Sub Reason_AfterUpdate()
On Error GoTo Reason_AfterUpdate_Err
DoCmd.GoToControl "Hold"
Reason_AfterUpdate_Exit:
Exit Sub
Reason_AfterUpdate_Err:
MsgBox Error$
Resume Reason_AfterUpdate_Exit
End Sub
'------------------------------------------------------------
' Combo30_AfterUpdate
'
'------------------------------------------------------------
Private Sub Combo30_AfterUpdate()
On Error GoTo Combo30_AfterUpdate_Err
' _AXL:<?xml version="1.0" encoding="UTF-16" standalone="no"?>
' <UserInterfaceMacro For="Reason" xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application" xmlns:a="http://schemas.microsoft.com/office/accessservices/2009/11/forms"><Sta
' _AXL:tements><Action Name="GoToControl"><Argument Name="ControlName">Hold</Argument></Action></Statements></UserInterfaceMacro>
DoCmd.GoToControl "Combo13"
Combo30_AfterUpdate_Exit:
Exit Sub
Combo30_AfterUpdate_Err:
MsgBox Error$
Resume Combo30_AfterUpdate_Exit
End Sub
'------------------------------------------------------------
' Command39_Click
'
'------------------------------------------------------------
Private Sub Command39_Click()
On Error GoTo Command39_Click_Err
' _AXL:<?xml version="1.0" encoding="UTF-16" standalone="no"?>
' <UserInterfaceMacro For="Combo30" Event="AfterUpdate" xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application" xmlns:a="http://schemas.microsoft.com/office/accessservice
' _AXL:s/2009/11/forms"><Statements><Action Name="GoToControl"><Argument Name="ControlName">Combo13</Argument></Action></Statements></UserInterfaceMacro>
On Error Resume Next
DoCmd.GoToControl Screen.PreviousControl.Name
Err.Clear
If (Not Form.NewRecord) Then
DoCmd.RunCommand acCmdDeleteRecord
End If
If (Form.NewRecord And Not Form.Dirty) Then
Beep
End If
If (Form.NewRecord And Form.Dirty) Then
DoCmd.RunCommand acCmdUndo
End If
If (MacroError <> 0) Then
Beep
MsgBox MacroError.Description, vbOKOnly, ""
End If
Command39_Click_Exit:
Exit Sub
Command39_Click_Err:
MsgBox Error$
Resume Command39_Click_Exit
End Sub
'------------------------------------------------------------
' Command28_Click
'
'------------------------------------------------------------
Private Sub Command28_Click()
On Error GoTo Command28_Click_Err
' _AXL:<?xml version="1.0" encoding="UTF-16" standalone="no"?>
' <UserInterfaceMacro For="Command39" xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application" xmlns:a="http://schemas.microsoft.com/office/accessservices/2009/11/forms"><
' _AXL:Statements><Action Name="OnError"/><Action Name="GoToControl"><Argument Name="ControlName">=[Screen].[PreviousControl].[Name]</Argument></Action><Action Name="ClearMacroError"/><ConditionalBlock><If><Condition>Not [Form].[NewRecord]</Condition><Sta
' _AXL:tements><Action Name="DeleteRecord"/></Statements></If></ConditionalBlock><ConditionalBlock><If><Condition>[Form].[NewRecord] And Not [Form].[Dirty]</Condition><Statements><Action Name="Beep"/></Statements></If></ConditionalBlock><ConditionalBlock>
' _AXL:<If><Condition>[Form].[NewRecord] And [Form].[Dirty]</Condition><Statements><Action Name="UndoRecord"/></Statements></If></ConditionalBlock><ConditionalBlock><If><Condition>[MacroError]<>0</Condition><Statements><Action Name="MessageBox"><Arg
' _AXL:ument Name="Message">=[MacroError].[Description]</Argument></Action></Statements></If></ConditionalBlock></Statements></UserInterfaceMacro>
Call DeleteRecordsMissingCodeCheck
DoCmd.Requery
DoCmd.OpenQuery "Append to MissingCodeCheck"
Call CheckForMissingCode("MissingCodeCheck", "EarningsCode")
If boolMissingCode = True Then
MsgBox "An Earnings Code must be entered for every employee!"
Hold.SetFocus
Else
DoCmd.Close , ""
Forms![SelectAbsenceDate]!Command33.Visible = True
End If
Command28_Click_Exit:
Exit Sub
Command28_Click_Err:
MsgBox Error$
Resume Command28_Click_Exit
End Sub