A
annedelina
Guest
Hi,
I have written some code and i get my message boxes like I am supposed to then when i reach the reocrd set where i am bout to add a new record, i am ginven an exception that boots me out of Access.
here is my code.
'Final Paryoll Docuemtnation
'This is the labor file update subform that is giving me problems.
Option Compare Database
Option Explicit
'This is a test to see if i can calculate without causing an illegal page fault.
Private Sub Elaptime_KeyPress(KeyAscii As Integer)
MsgBox ("Calculating Elaptime.")
Me.Elaptime = Me.Endtime - Me.Begtime
End Sub
Private Sub Form_AfterUpdate()
On Error GoTo Form_AfterUpdate_Err
DoCmd.GoToRecord , "", acNewRec
Form_AfterUpdate_Exit:
Exit Sub
Form_AfterUpdate_Err:
MsgBox Error$
Resume Form_AfterUpdate_Exit
End Sub
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Form_Open_Err
DoCmd.GoToRecord , "", acNewRec
Form_Open_Exit:
Exit Sub
Form_Open_Err:
MsgBox Error$
Resume Form_Open_Exit
End Sub
Private Sub Date_KeyPress(KeyAscii As Integer)
[Employee Labor Update]![Date].OldValue
End Sub
'this is to see if anything has changed.
Private Sub Form_Timer()
Dim fDirty As Boolean
fDirty = Me.Dirty
With Me!Elaptime
If Not (fDirty Eqv .Visible) Then .Visible = fDirty
End With
End Sub
'Private Sub Over20_Change()
'This is to see if the employee is working over 20
'MsgBox ("Here")
'DateAdd(1, 7, Me.Date) = Me.TotalHours
''Dim weeklyhours As Integer
''weeklyhours = DSum("TotalHours", "Elaptime", Me.Endtime - Me.Begtime)
'If (Me.Elaptime > 20) Then
' DoCmd.Beep
' MsgBox ("This Employee is working Over 20.")
' Me.Over20 = Me.tbSumHours - 20
'End If
'End Sub
Private Sub Over20_KeyPress(KeyAscii As Integer)
MsgBox ("Here")
DateAdd(1, 7, Me.Date) = Me.TotalHours
''Dim weeklyhours As Integer
''weeklyhours = DSum("TotalHours", "Elaptime", Me.Endtime - Me.Begtime)
If (Me.Elaptime > 20) Then
DoCmd.Beep
MsgBox ("This Employee is working Over 20.")
Me.Over20 = Me.tbSumHours - 20
End If
End Sub
'Private Sub Overtime_Change()
'This is a test to see if the employee has worked over 40 hours in a single week.
'MsgBox ("Here")
'If (Me.Elaptime > 40) Then
' DoCmd.Beep
' MsgBox ("This Employee has worked Overtime.")
' Me.Overtime = Me.tbSumHours - 40
'End If
'End Sub
Private Sub Overtime_KeyPress(KeyAscii As Integer)
MsgBox ("Here")
If (Me.Elaptime > 40) Then
DoCmd.Beep
MsgBox ("This Employee has worked Overtime.")
Me.Overtime = Me.tbSumHours - 40
End If
End Sub
Private Sub tbSumHours_KeyPress(KeyAscii As Integer)
MsgBox ("I'm Here.....")
Sum (Me.Elaptime)
End Sub
Private Sub TotalHours_AfterUpdate()
MsgBox ("TotalHours are being calculated.")
Sum (Me.Elaptime)
End Sub
Thank you for your help in advance. This is Vital cor completeion.
Anne Johnson
I have written some code and i get my message boxes like I am supposed to then when i reach the reocrd set where i am bout to add a new record, i am ginven an exception that boots me out of Access.
here is my code.
'Final Paryoll Docuemtnation
'This is the labor file update subform that is giving me problems.
Option Compare Database
Option Explicit
'This is a test to see if i can calculate without causing an illegal page fault.
Private Sub Elaptime_KeyPress(KeyAscii As Integer)
MsgBox ("Calculating Elaptime.")
Me.Elaptime = Me.Endtime - Me.Begtime
End Sub
Private Sub Form_AfterUpdate()
On Error GoTo Form_AfterUpdate_Err
DoCmd.GoToRecord , "", acNewRec
Form_AfterUpdate_Exit:
Exit Sub
Form_AfterUpdate_Err:
MsgBox Error$
Resume Form_AfterUpdate_Exit
End Sub
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Form_Open_Err
DoCmd.GoToRecord , "", acNewRec
Form_Open_Exit:
Exit Sub
Form_Open_Err:
MsgBox Error$
Resume Form_Open_Exit
End Sub
Private Sub Date_KeyPress(KeyAscii As Integer)
[Employee Labor Update]![Date].OldValue
End Sub
'this is to see if anything has changed.
Private Sub Form_Timer()
Dim fDirty As Boolean
fDirty = Me.Dirty
With Me!Elaptime
If Not (fDirty Eqv .Visible) Then .Visible = fDirty
End With
End Sub
'Private Sub Over20_Change()
'This is to see if the employee is working over 20
'MsgBox ("Here")
'DateAdd(1, 7, Me.Date) = Me.TotalHours
''Dim weeklyhours As Integer
''weeklyhours = DSum("TotalHours", "Elaptime", Me.Endtime - Me.Begtime)
'If (Me.Elaptime > 20) Then
' DoCmd.Beep
' MsgBox ("This Employee is working Over 20.")
' Me.Over20 = Me.tbSumHours - 20
'End If
'End Sub
Private Sub Over20_KeyPress(KeyAscii As Integer)
MsgBox ("Here")
DateAdd(1, 7, Me.Date) = Me.TotalHours
''Dim weeklyhours As Integer
''weeklyhours = DSum("TotalHours", "Elaptime", Me.Endtime - Me.Begtime)
If (Me.Elaptime > 20) Then
DoCmd.Beep
MsgBox ("This Employee is working Over 20.")
Me.Over20 = Me.tbSumHours - 20
End If
End Sub
'Private Sub Overtime_Change()
'This is a test to see if the employee has worked over 40 hours in a single week.
'MsgBox ("Here")
'If (Me.Elaptime > 40) Then
' DoCmd.Beep
' MsgBox ("This Employee has worked Overtime.")
' Me.Overtime = Me.tbSumHours - 40
'End If
'End Sub
Private Sub Overtime_KeyPress(KeyAscii As Integer)
MsgBox ("Here")
If (Me.Elaptime > 40) Then
DoCmd.Beep
MsgBox ("This Employee has worked Overtime.")
Me.Overtime = Me.tbSumHours - 40
End If
End Sub
Private Sub tbSumHours_KeyPress(KeyAscii As Integer)
MsgBox ("I'm Here.....")
Sum (Me.Elaptime)
End Sub
Private Sub TotalHours_AfterUpdate()
MsgBox ("TotalHours are being calculated.")
Sum (Me.Elaptime)
End Sub
Thank you for your help in advance. This is Vital cor completeion.
Anne Johnson