Date Calculation

D

Duane

A co-worker gave me a database (Paradox) that he needs converted to Access.
The database is an overtime equalization database that allows supervisors to
keep track of voluntary worked overtime.

Here is my dilemma:

The work schedule which is used is a rotating schedule. The schedule is
called a 6-2 (Work 6 and off 2). You start out with a Monday/Tuesday as you
days off. The following week you have Tuesday/Wednesday. Then you have
Wednesday/Thursday off. Then Thursday/Friday off. When you get to the
weekend you have Friday/Saturday/Sunday. The following week you have
Saturday/Sunday/Monday. Then the cycle starts over again. The cycle works
so you work 10 days in a two week period Each employee is assigned an RDO
(Regular Day Off)

There is a RDOrot (table). The fields in the table are as follows: Group
(LngInteger), MOD0 (Logical) Through MOD195 (Logical) A total of 196 MOD
fields. Each row in the table has the MOD fields set toTRUE to follow the
schedule for that group. Example: Row 1 - MOD0 = -1, MOD1 = -1, MOD8
= -1, MOD9 = -1, and so on, all the way through MOD195.

The code below shows some of the processes. Obviously this is where I get
lost.

[Code From Paradox]
myDate = date(theDate) ;assigns date from main page to var
myLongDate = longInt(myDate) ;converts the date to a long integer

myMod = smallInt(myLongDate.mod(196)) ;gets the remainder of myLongDate
divided by 196

myField = "MOD"+string(myMod) ;creates a string = MOD + myMod converted to
string

;the following query finds the 14 RDO groups on myDate
myQ = Query

:WORK:RDOrot.db|Group |~myField|
|check |True |

The schedule is such that there are two groups off on any given day. So
there is another table with two fields. Gr1 and Gr2. These fields hold the
group numbers derived from the calculation. On one day Gr1 would hold 1 and
Gr2 would hold 7. Then next day it would be Gr1=7 and Gr2=6.

Once the Group numbers are determined, reports are generated to show who is
available to work overtime on the date in question.

I appreciate any insight and direction you can give me. If there is another
group that is better suited for this question, I would appreciate that too.
The most important thing is that I want to learn the concept behind this.

Thank you very much.
Duane
 
D

Duane

I think I have it figured out. "I think!"

MyDate = Date()
LongDate = CLng(MyDate)
MyMOD = LongDate MOD 196
MsgBox MyMOD

The result is 102.

The table is setup so groups 1/2 are off those days. Adding one day changes
the result to 103 and groups 2/3 are off on that day.

Took some reading, but I think I am on the right track.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top