Link to home
Start Free TrialLog in
Avatar of arul mozhi
arul mozhi

asked on

how to make calender for 365 days

Hi!
I am a beginner in MS Access and using MS Access 2000. I have slowly and consistently learning the correct ways from the people like you. Now, for one of my database on Workers/Staffs Attendance, I need to fill one of a field with date from 1 Jan XXXX (now 2017) to 31 Dec XXXX.
example:  
1-jan-2017
2-jan-2017
3-jan-2017

....so on..
31-jan-2017

I need help to create query to automatically fill that filed with continuous date and next field with weekdays (sunday, monday..etc).
Please help me with sample coding and if any other easy steps are there, then let me know.
thanx.

Arul
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Arul,

  Usually pre-filling a table with records is a bad idea.   If your tracking attendance, you would simply record what days they attended.  Then when reporting, figure out if they had a day for that record or not.

Jim.
SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I agree with Jim.  It doesn't make any sense to prefill a table with empty attendance records.  it is especially bad when you know that at least 25% of them will NEVER be used.  Why put in a record for every day of the month when people only work 5 days a week.

The example Rey posted was simplistic and it just adds one record per day for a whole year.  What you are asking to do I believe would be to generate a month's worth of records for EACH worker.  That is still poor practice.  However, if you have a schedule table so you can identify which week days a person generally works, there is some logic (but not much) to pre-generating those records.  So if Sallie works mon-fri, you could generate an empty attendance record for those five days for all occurrences in a month.  Or Sam works weekends and holidays so the code would generate Sat and Sun records for Sam for a month but there would also need to be a holiday table available to include holidays and by extension, exclude them from the standard record generation.

In general, it is far better to add the records as needed.  That way you don't clutter up the database with records that are never relevant.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Question was fully answered.
Swell.  Every time Suzie, Sam, and the other 50 staff members login, they'll all add the same useless records; probably multiple times each day if this is a form they go to multiple times.  Hope this user knows enough to add a primary key or unique index to the table or it's going to grow like wildfire.  But the question was "fully" answered.