473,490 Members | 2,592 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Date Serial Issue

Hello,

I have what I believe amounts to a Date Serial issue. I have the following
columns in my table:

Hire-Date
Hire-Year
WTD-RATE
Wks-in-Yr

I need to create a calculation for PTO using these fields. If the person was
hired before 2005, their PTO would be calculated as [Weighted Rate] * [Wks-in-
Yr] * 40. If they were hired after 1/1/05, they are subject to different
parameters - if hired before 3/30: [Weighted Rate] * [Wks-in-Yr] * 10, if
hired before 6/30: [Weighted Rate] * [Wks-in-Yr] * 20, if hired before 9/30:
[Weighted Rate] * [Wks-in-Yr] * 30, else: [Weighted Rate] * [Wks-in-Yr] * 40.
I've written the following script:
PTO: IIf([HIRE-YEAR]<2005,((40*[WTD-RATE])/[TBLDAYSOFWEEK.WKS-IN-YR]),IIf(
[HIRE-DATE]<DateSerial(Year(Date()),3,31),((10*[WTD-RATE])/[TBLDAYSOFWEEK.WKS-
IN-YR]),IIf([HIRE-DATE] Between (DateSerial(Year(Date()),3,31)) And
(DateSerial(Year(Date()),6,30)),((20*[WTD-RATE])/[TBLDAYSOFWEEK.WKS-IN-YR]),
IIf([HIRE-DATE] Between (DateSerial(Year(Date()),6,30)) And (DateSerial(Year
(Date()),9,30)),((30*[WTD-RATE])/[TBLDAYSOFWEEK.WKS-IN-YR]),((40*[WTD-RATE])/
[TBLDAYSOFWEEK.WKS-IN-YR])))))

My problem is that I need to do these calculations prospecitively so Access
will only pro-rate these calculations in the year the person is hired. So if
I was hired in Aug 2005, my PTO would be pro-rated for 2005 but I would
receive the whole amount for 2006.

Any help would be very much appreciated!

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200602/1
Feb 1 '06 #1
3 2699
Glencannon4424 via AccessMonster.com wrote:
Hello,

I have what I believe amounts to a Date Serial issue. I have the following
columns in my table:

Hire-Date
Hire-Year
WTD-RATE
Wks-in-Yr

I need to create a calculation for PTO using these fields. If the person was
hired before 2005, their PTO would be calculated as [Weighted Rate] * [Wks-in-
Yr] * 40. If they were hired after 1/1/05, they are subject to different
parameters - if hired before 3/30: [Weighted Rate] * [Wks-in-Yr] * 10, if
hired before 6/30: [Weighted Rate] * [Wks-in-Yr] * 20, if hired before 9/30:
[Weighted Rate] * [Wks-in-Yr] * 30, else: [Weighted Rate] * [Wks-in-Yr] * 40.
I've written the following script:
PTO: IIf([HIRE-YEAR]<2005,((40*[WTD-RATE])/[TBLDAYSOFWEEK.WKS-IN-YR]),IIf(
[HIRE-DATE]<DateSerial(Year(Date()),3,31),((10*[WTD-RATE])/[TBLDAYSOFWEEK.WKS-
IN-YR]),IIf([HIRE-DATE] Between (DateSerial(Year(Date()),3,31)) And
(DateSerial(Year(Date()),6,30)),((20*[WTD-RATE])/[TBLDAYSOFWEEK.WKS-IN-YR]),
IIf([HIRE-DATE] Between (DateSerial(Year(Date()),6,30)) And (DateSerial(Year
(Date()),9,30)),((30*[WTD-RATE])/[TBLDAYSOFWEEK.WKS-IN-YR]),((40*[WTD-RATE])/
[TBLDAYSOFWEEK.WKS-IN-YR])))))

My problem is that I need to do these calculations prospecitively so Access
will only pro-rate these calculations in the year the person is hired. So if
I was hired in Aug 2005, my PTO would be pro-rated for 2005 but I would
receive the whole amount for 2006.

Any help would be very much appreciated!

Why don't you write a function? In the query builder, you could enter
something like
CalcIt : PTOCalc([Hire-Date],[Hire-Year],[WTD-RATE],[Wks-in-Yr]

Create a public code module called CalcIt and parse that mess up above
into readable code. I'd hate to debug the IIF statement.

Feb 2 '06 #2
Sounds a great suggestion but what is a public code module?

salad wrote:
Hello,

[quoted text clipped - 28 lines]

Any help would be very much appreciated!


Why don't you write a function? In the query builder, you could enter
something like
CalcIt : PTOCalc([Hire-Date],[Hire-Year],[WTD-RATE],[Wks-in-Yr]

Create a public code module called CalcIt and parse that mess up above
into readable code. I'd hate to debug the IIF statement.


--
Message posted via http://www.accessmonster.com
Feb 2 '06 #3

"Glencannon4424 via AccessMonster.com" <u17590@uwe> wrote
Sounds a great suggestion but what is a
public code module?


In Access database window, click the Modules tab, then click "New". Voila,
you will be taken to the module window (sometimes called the Integrated
Development Environment, IDE) with a new public code module opened.

You can create in the General/Declarations declarations of variables and
constants, and in the rest of the module, write VBA code in Function and Sub
procedures. But, if you had to ask the "what is" question, it is likely you
have some learning curve yet to climb before writing any code on your own.

Larry Linson
Microsoft Access MVP
Feb 2 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
5890
by: Silke | last post by:
Hi all! I'm trying to write a program in python using the modules 'serialwin32' and 'thread' to create one thread that writes to a serial port and another one that reads from it at 'the same...
3
3242
by: Stewart Allen | last post by:
Hi there I'm trying to find part serial numbers between 2 numbers. The user selects a part number from a combo box and then enters a range of serial numbers into 2 text boxes and the resulting...
3
5017
by: collinm | last post by:
hi i send a command to a led display, the led display is suppose to return me some character i write a string on a serial port void ledDisplayExist() { char msg={'\0', '\0', '\0', '\0',...
4
15348
by: Daniel Kaseman | last post by:
How do I convert a date into a serial number? (I'm trying to enter a FROM date and a TO date, then make my PROGRESS BAR show how close I am to the TO date.) get it? I know that MS Excel...
12
13832
by: Emi Lu | last post by:
Hello all, I have a question about "date" & "timestamp" types in PostgreSQL. I want to setup the default value '0000-00-00' and "0000-00-00 00:00:00" for them. However, it seems that PostgreSQL...
4
5295
by: Peter | last post by:
What is the easiest way to convert serialdate (like excel has) into real date in VB.NET? Thank You Peter
8
16321
by: Vivek Menon | last post by:
Hi, I am using a C program to write/read from a serial port. The writing part is working perfectly fine. However, I am not able to read the values correctly and display them. To debug this issue I...
13
6163
by: Rob | last post by:
Hi all, I am fairly new to python, but not programming and embedded. I am having an issue which I believe is related to the hardware, triggered by the software read I am doing in pySerial. I...
6
6624
by: terry | last post by:
Hi, I am trying to send a character to '/dev/ttyS0' and expect the same character and upon receipt I want to send another character. I tired with Pyserial but in vain. Test Set up: 1. Send...
0
6974
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7146
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7183
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7356
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4878
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4573
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3074
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.