Calculating Vacation Time

Then let me look at it first before Mr Phile gets his scissors out
 
denileigh said:
Are you teaching me things the hard way? hehehehe

Here ya go....
http://users2.ev1.net/~dls4967/VACATION.zip

Phew I'm in the clear :cool:
You changed the names of all my variables
This is how it should read

:)

Dim db As DAO.Database ' DAO
Dim db As DAO.Database ' DAO
Dim rec As DAO.Recordset ' DAO
Dim datHireDate As Integer
Dim dat40 As Integer
Dim dat80 As Integer
Dim dat120 As Integer
Dim strStartDate As String

Set db = CurrentDb()
Set rec = db.OpenRecordset("EMPLOYEES")
Do Until rec.EOF
strStartDate = rec.Fields("HireDate")
datEmployed = DateDiff("d", strStartDate, Date)
dat40 = DateDiff("d", strStartDate, DateAdd("yyyy", 1, strStartDate))
dat80 = DateDiff("d", strStartDate, "01/01/" & Year(DateAdd("yyyy", 2, strStartDate)))
dat120 = DateDiff("d", strStartDate, DateAdd("yyyy", 10, strStartDate))
If datHireDate < dat40 Then
rec.Edit
rec.Fields("VacHrsAvailable") = "0"
rec.Update
End If
If datHireDate >= dat40 And datHireDate < dat80 Then
rec.Edit
rec.Fields("VacHrsAvailable") = "40"
rec.Update
End If
If datHireDate >= dat80 And datHireDate < dat120 Then
rec.Edit
rec.Fields("VacHrsAvailable") = "80"
rec.Update
End If
rec.Edit
If datHireDate >= dat120 Then
rec.Fields("VacHrsAvailable") = "120"
rec.Update
End If
rec.MoveNext
Loop
rec.Close
End Sub
 
WHOOPS

I thought that was the hire date!

Sorry for being retarded!
 
But is still isn't working...UGH!!!!! Not putting anything in the VacHrsAvailable now.

Do I put a text box on the form and give it that name or do I use it from the field list from the employees table?
 
What are you doing to my precious code? :(
I got it to work on your db LOL

Private message me your email address and I'll send it to you
 
Howdy....this is a revisit to this topic...I don't know if I need to post a new one or not.

How to I make this auto-update? Can the if/then statement be put into the table itself?
 

Users who are viewing this thread

Back
Top Bottom