Mendip Data Systems

Database applications for businesses and schools

LogoTransparent

Example Apps for Businesses, Schools & Personal Use

Version 1.0      Updated 25/06/2017              Approx 34kB

 

Someone asked me to create a simple day tracker for counting the number of days since an event or until an event

 

I thought I'd upload it in case its of any use to anyone else

There's nothing at all 'fancy' about it.

 

However anyone unfamiliar with the syntax used for easily coding multiple repeated events may find this worth adapting for other purposes

 

For example:

Day Tracker  

Click the image to view a larger version ...

Screenshots

Return to Example Databases Page

Click to download:  Day Tracker (zipped)

Private Sub InitialiseForm()

 

   'clear previous values

   For I = 1 To 12

       Me("lblDays" & I).Caption = ""

       Me("lblDays" & I).Visible = False

   Next

 

'populate controls

   For I = 1 To 6

       Me("lblDate" & I) = Nz(DLookup("Event", "tblDaysFrom", "ID = " & I), "")

       Me("txtDate" & I) = Nz(DLookup("StartDate", "tblDaysFrom", "ID = " & I), "")

       

       dteDate = Nz(DLookup("StartDate", "tblDaysFrom", "ID = " & I), Date)

       Me("lblDays" & I).Caption = Nz(DateDiff("d", dteDate, Date), 0)

       

       If Me("lblDays" & I).Caption > 0 Then Me("lblDays" & I).Visible = True

   Next

   

   For I = 7 To 12

       Me("lblDate" & I) = Nz(DLookup("Event", "tblDaysTo", "ID = " & (I - 6)), "")

       Me("txtDate" & I) = Nz(DLookup("EndDate", "tblDaysTo", "ID = " & (I - 6)), "")

       

       dteDate = Nz(DLookup("EndDate", "tblDaysTo", "ID = " & (I - 6)), Date)

       Me("lblDays" & I).Caption = Nz(DateDiff("d", Date, dteDate), 0)

       

       If Me("lblDays" & I).Caption > 0 Then Me("lblDays" & I).Visible = True

   Next

   

End Sub

DayTracker