CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2000
    Posts
    9

    access vba for payroll project

    Please help. I have attached my code. When I reach the end of a recordset and am about to add a new reocrd. I get an exception error that boots me out of access all together.
    please help. This project is laready past deadline and i have to finish it bfore the middle of March.
    thanks.
    Anne Johnson


    '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





  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: access vba for payroll project

    I have 2 possible explanations for this

    1) The computer it's running on does not have BOTH Access and VB installed on it, try running it on another computer, with BOTH the programs

    2) Access (specially older versions) can have problems handling forms build upon
    a) more then 3 query's
    eg: when using several query's to fill listboxes etc
    b) 1 query gathering data from more then 3 tables
    eg: merging 5 tables into 1 single query

    I'm sorry that I can't give you a concrete solution, but you are free to email me the database, and I will have a look at it.

    Tom Cannaerts
    [email protected]

    The best way to escape a problem, is to solve it.
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  3. #3
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: access vba for payroll project

    I toke a look at the database and made some modifications.
    One thing always generating an error was the error$ variable.
    Use err.description instead.

    I mailed you the database, read the txt file for more info

    Tom Cannaerts
    [email protected]

    The best way to escape a problem, is to solve it.
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  4. #4
    Join Date
    Jan 2000
    Posts
    9

    Re: access vba for payroll project

    Thanks for all of your help. Please re-send the database. Right now, my student account has a block on the size of attachemts. Please email it to me at this address.
    [email protected]
    thanks,
    anne


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured