Go Back   Access World Forums > Microsoft Access Reference > Sample Databases

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 06-25-2017, 04:17 AM   #1
ridders
Part time moderator
 
ridders's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 5,797
Thanks: 79
Thanked 1,426 Times in 1,331 Posts
ridders is just really nice ridders is just really nice ridders is just really nice ridders is just really nice
Day Tracker

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:
Code:
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
Attached Images
File Type: png DayTracker.PNG (17.4 KB, 274 views)
Attached Files
File Type: accdb DayTracker.accdb (496.0 KB, 282 views)

__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

New example databases:

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

-----------------------------------------------------------------------------------
nil illegitimi carborundum est
ridders is offline   Reply With Quote
The Following User Says Thank You to ridders For This Useful Post:
usm01 (12-17-2017)
Reply

Tags
day tracker

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibration Tracker Jmclel Sample Databases 0 08-16-2014 11:56 AM
Incident Tracker Kubalism Forms 19 07-04-2012 11:23 PM
Question Attendance Tracker asif pasha General 4 06-02-2011 07:39 AM
Help with Tracker cooh23 Tables 8 12-11-2007 01:36 PM
User tracker 31si General 1 02-15-2007 10:21 AM




All times are GMT -8. The time now is 05:02 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World