Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    North Dakota, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Find a PayDate when deduction reaches amount (2000)

    Here's the situation. Employees have payroll deductions. I need to find out the paydate when a certain deduction reaches over $200. I'm not sure how to do this.

    This is what I have so far.
    I have a form with a txtReportDate and txtDeductionAmt and a command button. Here's what i have behind the command button.

    Private Sub Command3_Click()

    Dim dtNextPayDate As Date
    dtNextPayDate = #1/3/2003# 'This is the first paydate of this year.

    Dim intCount As Integer
    intCount = 0

    Dim intAmount As Integer 'not using this variable yet
    intAmount = Me.txtDeductionAmt

    'lists and counts the number of pay dates between the variable and the date on the form
    Do Until dtNextPayDate >= Me.txtReportDate
    dtNextPayDate = dtNextPayDate + 14
    intCount = intCount + 1
    Loop

    MsgBox "Done. " & intCount & " pay periods."

    End Sub

    How do I add the calculation of the deduction amounts? Do I need to store the paydates in an array so I can do a For Each...Next loop adding the deduction amounts together for each paydate?

    I'm not sure what sort of logic I need to do. Thanks.
    Sarah

  2. #2
    3 Star Lounger
    Join Date
    May 2002
    Location
    Toronto, Ontario, Canada
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Find a PayDate when deduction reaches amount (2000)

    Hi Sarah...

    There are a lot of questions that come to mind but I

  3. #3
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    North Dakota, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Find a PayDate when deduction reaches amount (2000)

    Yes, I realize my code was not doing what I wanted, but I was guessing that the loop could be modified to do what I wanted. It just was a starting point.

    You assumed right. The code you suggested worked out good for me.

    Thanks for the help.
    Sarah

Posting Permissions

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