S
SoggyCashew
Hello, Im using a module that I use to give me the total days from a start
date from my table named tblPlantInfo. I have a text box on my form to
display the number of days using a test box on a form and its Default Value
is ShowLastLTI(). This is a date that will not change unless we have an
accident and then we will have new start date. Anyway, we are going to start
not counting every day unless we are working that day so each holiday would
have to be removed from my total days and sometimes we work Saturday and
sometimes we we dont. I would like to be able to have a table where I could
enter a date that we didnt work and have somewhere in the module check for an
entry in that table and if there is one then subtract a day from my total
days. Here is my module im using to get a total days.
Option Compare Database
Option Explicit
Public LastLTI
Public Function GetLastLTI()
Dim dbs As Database, rstPlantInfo As Recordset
Set dbs = CurrentDb
Set rstPlantInfo = dbs.OpenRecordset("tblPlantInfo", dbOpenSnapshot)
rstPlantInfo.MoveFirst
LastLTI = rstPlantInfo![LastLTI]
rstPlantInfo.Close
End Function
Public Function ShowLastLTI()
Dim mydate As Date
Call GetLastLTI
mydate = LastLTI
ShowLastLTI = DateDiff("d", mydate, Now() - 1) & " days since last Lost Work
Time Injury"
End Function
date from my table named tblPlantInfo. I have a text box on my form to
display the number of days using a test box on a form and its Default Value
is ShowLastLTI(). This is a date that will not change unless we have an
accident and then we will have new start date. Anyway, we are going to start
not counting every day unless we are working that day so each holiday would
have to be removed from my total days and sometimes we work Saturday and
sometimes we we dont. I would like to be able to have a table where I could
enter a date that we didnt work and have somewhere in the module check for an
entry in that table and if there is one then subtract a day from my total
days. Here is my module im using to get a total days.
Option Compare Database
Option Explicit
Public LastLTI
Public Function GetLastLTI()
Dim dbs As Database, rstPlantInfo As Recordset
Set dbs = CurrentDb
Set rstPlantInfo = dbs.OpenRecordset("tblPlantInfo", dbOpenSnapshot)
rstPlantInfo.MoveFirst
LastLTI = rstPlantInfo![LastLTI]
rstPlantInfo.Close
End Function
Public Function ShowLastLTI()
Dim mydate As Date
Call GetLastLTI
mydate = LastLTI
ShowLastLTI = DateDiff("d", mydate, Now() - 1) & " days since last Lost Work
Time Injury"
End Function