Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automation

Status
Not open for further replies.

3239

Technical User
May 14, 2003
64
How do I get access to automatically add a number to an existing number for each month into my database. For example, lets say that I have a database that keeps track of an employee's vacation time, And each month every employee earns 10 hours of vacation time. How would I get access to automatically add 10 hours of vacation time to every employees time each month.
 
Createa a module that runs when your DB is started.

Test for the date. If its the first of the month, create a recordset to your table, loop through and add 10 hours for each employee.

e.g.

Dim rs as DAO.Recordset 'hey.. I like DAO ok? :D

If left(format(date, "dd mmm yyyy"),2) = "01" Then
'First of the Month.. Execute Code

set rs = currentdb.openrecordset("tablname", dbopendynaset)
rs.movefirst
While not RS.EOF
With rs
.Edit
!VacationTime = !VacationTime + 10
.Update
.MoveNext
End With
Wend

Else
' No the first of the month..
End If

------------------------
Hit any User to continue
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top