A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Vacation Query



 
 
Thread Tools Display Modes
  #1  
Old July 27th, 2006, 04:51 PM posted to microsoft.public.access.queries
Julie
external usenet poster
 
Posts: 448
Default Vacation Query

What I need to figure out now is how to get a query to look at their
anniversary date and add in what amount they get awarded and also to deduct
what they have taken to date. When a new employee is eligible for vacation is
on their anniversary date and then they can start taking it. So, if someone
starts in march they have to wait until the following march to use their
vacation. Can anyone help?


  #2  
Old July 27th, 2006, 06:26 PM posted to microsoft.public.access.queries
Klatuu
external usenet poster
 
Posts: 7,074
Default Vacation Query

Need more information.
How do you know how much vacation an employee is eligible for?
How do you know how much they have used in the current year?

"Julie" wrote:

What I need to figure out now is how to get a query to look at their
anniversary date and add in what amount they get awarded and also to deduct
what they have taken to date. When a new employee is eligible for vacation is
on their anniversary date and then they can start taking it. So, if someone
starts in march they have to wait until the following march to use their
vacation. Can anyone help?


  #3  
Old July 31st, 2006, 03:30 PM posted to microsoft.public.access.queries
Julie
external usenet poster
 
Posts: 448
Default Vacation Query

I have set up a table to look up for each person. Here is an example
1 year - 40 hrs
2 years - 80 hrs
7 years - 120 hrs
12 years - 160 hrs.

I have designed a form that inputs everyone's vacation for the year. I just
don't know how to get access to look at what time they have taken and deduct
it from what they were awarded for that year.

"Klatuu" wrote:

Need more information.
How do you know how much vacation an employee is eligible for?
How do you know how much they have used in the current year?

"Julie" wrote:

What I need to figure out now is how to get a query to look at their
anniversary date and add in what amount they get awarded and also to deduct
what they have taken to date. When a new employee is eligible for vacation is
on their anniversary date and then they can start taking it. So, if someone
starts in march they have to wait until the following march to use their
vacation. Can anyone help?


  #4  
Old July 31st, 2006, 03:56 PM posted to microsoft.public.access.queries
Klatuu
external usenet poster
 
Posts: 7,074
Default Vacation Query

Do you have a field that shows how much time has been taken for the current
year?
There is probably a little complexity here in that your vacation allotments
are probably calculated on an employee's original hire date, but what time is
actually used is calculated on a calendar date (Jan 1 - Dec 31).

In any case, here is a function originally written to determine a person's
age as of a date. It will work for you in determining how long a person has
been employed.

Function CalcAge(varDOB As Variant, Optional varAsOf As Variant) As Variant
'Purpose: Return the Age in years.
'Arguments: varDOB = Date Of Birth
' varAsOf = the date to calculate the age at, or today if
missing.
'Return: Whole number of years.
Dim dtmDOB As Date
Dim dtmAsOf As Date
Dim dtmBDay As Date 'Birthday in the year of calculation.

CalcAge = Null 'Initialize to Null

'Validate parameters
If IsDate(varDOB) Then
dtmDOB = varDOB

If IsDate(varAsOf) Then 'Date to calculate age from.
dtmAsOf = varAsOf
Else
dtmAsOf = date
End If

If dtmAsOf = dtmDOB Then 'Calculate only if it's after person was
born.
dtmBDay = DateSerial(year(dtmAsOf), Month(dtmDOB), Day(dtmDOB))
CalcAge = DateDiff("yyyy", dtmDOB, dtmAsOf) + (dtmBDay dtmAsOf)
Else: CalcAge = Null 'Return Null if AsOf is before birthday
End If
End If
End Function

You can determine how many hours they are eligible for with this:

Function VacHoursEarned(intYears AS integer) As Integer

Select Case intYears
Case is 1
intYears = 40
Case is 2 To 6
intYears = 80
Case is 7 To 11
intYears = 120
Case is =12
intYears = 160
End Select
End Function




"Julie" wrote:

I have set up a table to look up for each person. Here is an example
1 year - 40 hrs
2 years - 80 hrs
7 years - 120 hrs
12 years - 160 hrs.

I have designed a form that inputs everyone's vacation for the year. I just
don't know how to get access to look at what time they have taken and deduct
it from what they were awarded for that year.

"Klatuu" wrote:

Need more information.
How do you know how much vacation an employee is eligible for?
How do you know how much they have used in the current year?

"Julie" wrote:

What I need to figure out now is how to get a query to look at their
anniversary date and add in what amount they get awarded and also to deduct
what they have taken to date. When a new employee is eligible for vacation is
on their anniversary date and then they can start taking it. So, if someone
starts in march they have to wait until the following march to use their
vacation. Can anyone help?


  #5  
Old August 16th, 2006, 06:49 PM posted to microsoft.public.access.queries
Secret Squirrel
external usenet poster
 
Posts: 683
Default Vacation Query

Hi,
I want to use your function to determine the Vacation hours earned but I'm
unsure how to have it look at the textbox on my form to determine which case
it should use. Can you help shed some light on how I would set this up? I
have a form with a textbox on it that calculates a persons time of employment
from their hiredate until the present date. Now I want the data in that field
to be compared to the select case function you wrote below and have it
populate the hours earned into another textbox.
Thanks
SS

"Klatuu" wrote:

Do you have a field that shows how much time has been taken for the current
year?
There is probably a little complexity here in that your vacation allotments
are probably calculated on an employee's original hire date, but what time is
actually used is calculated on a calendar date (Jan 1 - Dec 31).

In any case, here is a function originally written to determine a person's
age as of a date. It will work for you in determining how long a person has
been employed.

Function CalcAge(varDOB As Variant, Optional varAsOf As Variant) As Variant
'Purpose: Return the Age in years.
'Arguments: varDOB = Date Of Birth
' varAsOf = the date to calculate the age at, or today if
missing.
'Return: Whole number of years.
Dim dtmDOB As Date
Dim dtmAsOf As Date
Dim dtmBDay As Date 'Birthday in the year of calculation.

CalcAge = Null 'Initialize to Null

'Validate parameters
If IsDate(varDOB) Then
dtmDOB = varDOB

If IsDate(varAsOf) Then 'Date to calculate age from.
dtmAsOf = varAsOf
Else
dtmAsOf = date
End If

If dtmAsOf = dtmDOB Then 'Calculate only if it's after person was
born.
dtmBDay = DateSerial(year(dtmAsOf), Month(dtmDOB), Day(dtmDOB))
CalcAge = DateDiff("yyyy", dtmDOB, dtmAsOf) + (dtmBDay dtmAsOf)
Else: CalcAge = Null 'Return Null if AsOf is before birthday
End If
End If
End Function

You can determine how many hours they are eligible for with this:

Function VacHoursEarned(intYears AS integer) As Integer

Select Case intYears
Case is 1
intYears = 40
Case is 2 To 6
intYears = 80
Case is 7 To 11
intYears = 120
Case is =12
intYears = 160
End Select
End Function




"Julie" wrote:

I have set up a table to look up for each person. Here is an example
1 year - 40 hrs
2 years - 80 hrs
7 years - 120 hrs
12 years - 160 hrs.

I have designed a form that inputs everyone's vacation for the year. I just
don't know how to get access to look at what time they have taken and deduct
it from what they were awarded for that year.

"Klatuu" wrote:

Need more information.
How do you know how much vacation an employee is eligible for?
How do you know how much they have used in the current year?

"Julie" wrote:

What I need to figure out now is how to get a query to look at their
anniversary date and add in what amount they get awarded and also to deduct
what they have taken to date. When a new employee is eligible for vacation is
on their anniversary date and then they can start taking it. So, if someone
starts in march they have to wait until the following march to use their
vacation. Can anyone help?


  #6  
Old August 16th, 2006, 07:06 PM posted to microsoft.public.access.queries
Klatuu
external usenet poster
 
Posts: 7,074
Default Vacation Query

If you want to use the value in a text box, just pass the value in the text
box as the function's argument:
VacHoursEarned(Me.txtYrsService)

"Secret Squirrel" wrote:

Hi,
I want to use your function to determine the Vacation hours earned but I'm
unsure how to have it look at the textbox on my form to determine which case
it should use. Can you help shed some light on how I would set this up? I
have a form with a textbox on it that calculates a persons time of employment
from their hiredate until the present date. Now I want the data in that field
to be compared to the select case function you wrote below and have it
populate the hours earned into another textbox.
Thanks
SS

"Klatuu" wrote:

Do you have a field that shows how much time has been taken for the current
year?
There is probably a little complexity here in that your vacation allotments
are probably calculated on an employee's original hire date, but what time is
actually used is calculated on a calendar date (Jan 1 - Dec 31).

In any case, here is a function originally written to determine a person's
age as of a date. It will work for you in determining how long a person has
been employed.

Function CalcAge(varDOB As Variant, Optional varAsOf As Variant) As Variant
'Purpose: Return the Age in years.
'Arguments: varDOB = Date Of Birth
' varAsOf = the date to calculate the age at, or today if
missing.
'Return: Whole number of years.
Dim dtmDOB As Date
Dim dtmAsOf As Date
Dim dtmBDay As Date 'Birthday in the year of calculation.

CalcAge = Null 'Initialize to Null

'Validate parameters
If IsDate(varDOB) Then
dtmDOB = varDOB

If IsDate(varAsOf) Then 'Date to calculate age from.
dtmAsOf = varAsOf
Else
dtmAsOf = date
End If

If dtmAsOf = dtmDOB Then 'Calculate only if it's after person was
born.
dtmBDay = DateSerial(year(dtmAsOf), Month(dtmDOB), Day(dtmDOB))
CalcAge = DateDiff("yyyy", dtmDOB, dtmAsOf) + (dtmBDay dtmAsOf)
Else: CalcAge = Null 'Return Null if AsOf is before birthday
End If
End If
End Function

You can determine how many hours they are eligible for with this:

Function VacHoursEarned(intYears AS integer) As Integer

Select Case intYears
Case is 1
intYears = 40
Case is 2 To 6
intYears = 80
Case is 7 To 11
intYears = 120
Case is =12
intYears = 160
End Select
End Function




"Julie" wrote:

I have set up a table to look up for each person. Here is an example
1 year - 40 hrs
2 years - 80 hrs
7 years - 120 hrs
12 years - 160 hrs.

I have designed a form that inputs everyone's vacation for the year. I just
don't know how to get access to look at what time they have taken and deduct
it from what they were awarded for that year.

"Klatuu" wrote:

Need more information.
How do you know how much vacation an employee is eligible for?
How do you know how much they have used in the current year?

"Julie" wrote:

What I need to figure out now is how to get a query to look at their
anniversary date and add in what amount they get awarded and also to deduct
what they have taken to date. When a new employee is eligible for vacation is
on their anniversary date and then they can start taking it. So, if someone
starts in march they have to wait until the following march to use their
vacation. Can anyone help?


  #7  
Old August 16th, 2006, 07:23 PM posted to microsoft.public.access.queries
Secret Squirrel
external usenet poster
 
Posts: 683
Default Vacation Query

How do I call this function from the textbox where I want it to populate the
hours earned?

"Klatuu" wrote:

If you want to use the value in a text box, just pass the value in the text
box as the function's argument:
VacHoursEarned(Me.txtYrsService)

"Secret Squirrel" wrote:

Hi,
I want to use your function to determine the Vacation hours earned but I'm
unsure how to have it look at the textbox on my form to determine which case
it should use. Can you help shed some light on how I would set this up? I
have a form with a textbox on it that calculates a persons time of employment
from their hiredate until the present date. Now I want the data in that field
to be compared to the select case function you wrote below and have it
populate the hours earned into another textbox.
Thanks
SS

"Klatuu" wrote:

Do you have a field that shows how much time has been taken for the current
year?
There is probably a little complexity here in that your vacation allotments
are probably calculated on an employee's original hire date, but what time is
actually used is calculated on a calendar date (Jan 1 - Dec 31).

In any case, here is a function originally written to determine a person's
age as of a date. It will work for you in determining how long a person has
been employed.

Function CalcAge(varDOB As Variant, Optional varAsOf As Variant) As Variant
'Purpose: Return the Age in years.
'Arguments: varDOB = Date Of Birth
' varAsOf = the date to calculate the age at, or today if
missing.
'Return: Whole number of years.
Dim dtmDOB As Date
Dim dtmAsOf As Date
Dim dtmBDay As Date 'Birthday in the year of calculation.

CalcAge = Null 'Initialize to Null

'Validate parameters
If IsDate(varDOB) Then
dtmDOB = varDOB

If IsDate(varAsOf) Then 'Date to calculate age from.
dtmAsOf = varAsOf
Else
dtmAsOf = date
End If

If dtmAsOf = dtmDOB Then 'Calculate only if it's after person was
born.
dtmBDay = DateSerial(year(dtmAsOf), Month(dtmDOB), Day(dtmDOB))
CalcAge = DateDiff("yyyy", dtmDOB, dtmAsOf) + (dtmBDay dtmAsOf)
Else: CalcAge = Null 'Return Null if AsOf is before birthday
End If
End If
End Function

You can determine how many hours they are eligible for with this:

Function VacHoursEarned(intYears AS integer) As Integer

Select Case intYears
Case is 1
intYears = 40
Case is 2 To 6
intYears = 80
Case is 7 To 11
intYears = 120
Case is =12
intYears = 160
End Select
End Function




"Julie" wrote:

I have set up a table to look up for each person. Here is an example
1 year - 40 hrs
2 years - 80 hrs
7 years - 120 hrs
12 years - 160 hrs.

I have designed a form that inputs everyone's vacation for the year. I just
don't know how to get access to look at what time they have taken and deduct
it from what they were awarded for that year.

"Klatuu" wrote:

Need more information.
How do you know how much vacation an employee is eligible for?
How do you know how much they have used in the current year?

"Julie" wrote:

What I need to figure out now is how to get a query to look at their
anniversary date and add in what amount they get awarded and also to deduct
what they have taken to date. When a new employee is eligible for vacation is
on their anniversary date and then they can start taking it. So, if someone
starts in march they have to wait until the following march to use their
vacation. Can anyone help?


  #8  
Old August 16th, 2006, 07:52 PM posted to microsoft.public.access.queries
Klatuu
external usenet poster
 
Posts: 7,074
Default Vacation Query

Assuming it is not a bound field (and it should not be, because it violates
the rule on storing calculated values), you can put it in the Control Source
property for the text box. To ensure the values needed are available, see
the modification below:
(Also I noticed the function had a missing line of code, so it would never
return anything

Function VacHoursEarned(varYears AS Variant) As Integer

If IsNull(varYears) Then
VacHoursEarned = Null
Exit Function
End If
Select Case varYears
Case is 1
VacHoursEarned = 40
Case is 2 To 6
VacHoursEarned = 80
Case is 7 To 11
VacHoursEarned = 120
Case is =12
VacHoursEarned = 160
End Select
End Function


"Secret Squirrel" wrote:

How do I call this function from the textbox where I want it to populate the
hours earned?

"Klatuu" wrote:

If you want to use the value in a text box, just pass the value in the text
box as the function's argument:
VacHoursEarned(Me.txtYrsService)

"Secret Squirrel" wrote:

Hi,
I want to use your function to determine the Vacation hours earned but I'm
unsure how to have it look at the textbox on my form to determine which case
it should use. Can you help shed some light on how I would set this up? I
have a form with a textbox on it that calculates a persons time of employment
from their hiredate until the present date. Now I want the data in that field
to be compared to the select case function you wrote below and have it
populate the hours earned into another textbox.
Thanks
SS

"Klatuu" wrote:

Do you have a field that shows how much time has been taken for the current
year?
There is probably a little complexity here in that your vacation allotments
are probably calculated on an employee's original hire date, but what time is
actually used is calculated on a calendar date (Jan 1 - Dec 31).

In any case, here is a function originally written to determine a person's
age as of a date. It will work for you in determining how long a person has
been employed.

Function CalcAge(varDOB As Variant, Optional varAsOf As Variant) As Variant
'Purpose: Return the Age in years.
'Arguments: varDOB = Date Of Birth
' varAsOf = the date to calculate the age at, or today if
missing.
'Return: Whole number of years.
Dim dtmDOB As Date
Dim dtmAsOf As Date
Dim dtmBDay As Date 'Birthday in the year of calculation.

CalcAge = Null 'Initialize to Null

'Validate parameters
If IsDate(varDOB) Then
dtmDOB = varDOB

If IsDate(varAsOf) Then 'Date to calculate age from.
dtmAsOf = varAsOf
Else
dtmAsOf = date
End If

If dtmAsOf = dtmDOB Then 'Calculate only if it's after person was
born.
dtmBDay = DateSerial(year(dtmAsOf), Month(dtmDOB), Day(dtmDOB))
CalcAge = DateDiff("yyyy", dtmDOB, dtmAsOf) + (dtmBDay dtmAsOf)
Else: CalcAge = Null 'Return Null if AsOf is before birthday
End If
End If
End Function

You can determine how many hours they are eligible for with this:

Function VacHoursEarned(intYears AS integer) As Integer

Select Case intYears
Case is 1
intYears = 40
Case is 2 To 6
intYears = 80
Case is 7 To 11
intYears = 120
Case is =12
intYears = 160
End Select
End Function




"Julie" wrote:

I have set up a table to look up for each person. Here is an example
1 year - 40 hrs
2 years - 80 hrs
7 years - 120 hrs
12 years - 160 hrs.

I have designed a form that inputs everyone's vacation for the year. I just
don't know how to get access to look at what time they have taken and deduct
it from what they were awarded for that year.

"Klatuu" wrote:

Need more information.
How do you know how much vacation an employee is eligible for?
How do you know how much they have used in the current year?

"Julie" wrote:

What I need to figure out now is how to get a query to look at their
anniversary date and add in what amount they get awarded and also to deduct
what they have taken to date. When a new employee is eligible for vacation is
on their anniversary date and then they can start taking it. So, if someone
starts in march they have to wait until the following march to use their
vacation. Can anyone help?


  #9  
Old August 16th, 2006, 08:17 PM posted to microsoft.public.access.queries
Secret Squirrel
external usenet poster
 
Posts: 683
Default Vacation Query

Thanks for that Klatuu but I have one more question. How do I tell this code
to look at my textbox "Years" to find out which case it falls into?

"Klatuu" wrote:

Assuming it is not a bound field (and it should not be, because it violates
the rule on storing calculated values), you can put it in the Control Source
property for the text box. To ensure the values needed are available, see
the modification below:
(Also I noticed the function had a missing line of code, so it would never
return anything

Function VacHoursEarned(varYears AS Variant) As Integer

If IsNull(varYears) Then
VacHoursEarned = Null
Exit Function
End If
Select Case varYears
Case is 1
VacHoursEarned = 40
Case is 2 To 6
VacHoursEarned = 80
Case is 7 To 11
VacHoursEarned = 120
Case is =12
VacHoursEarned = 160
End Select
End Function


"Secret Squirrel" wrote:

How do I call this function from the textbox where I want it to populate the
hours earned?

"Klatuu" wrote:

If you want to use the value in a text box, just pass the value in the text
box as the function's argument:
VacHoursEarned(Me.txtYrsService)

"Secret Squirrel" wrote:

Hi,
I want to use your function to determine the Vacation hours earned but I'm
unsure how to have it look at the textbox on my form to determine which case
it should use. Can you help shed some light on how I would set this up? I
have a form with a textbox on it that calculates a persons time of employment
from their hiredate until the present date. Now I want the data in that field
to be compared to the select case function you wrote below and have it
populate the hours earned into another textbox.
Thanks
SS

"Klatuu" wrote:

Do you have a field that shows how much time has been taken for the current
year?
There is probably a little complexity here in that your vacation allotments
are probably calculated on an employee's original hire date, but what time is
actually used is calculated on a calendar date (Jan 1 - Dec 31).

In any case, here is a function originally written to determine a person's
age as of a date. It will work for you in determining how long a person has
been employed.

Function CalcAge(varDOB As Variant, Optional varAsOf As Variant) As Variant
'Purpose: Return the Age in years.
'Arguments: varDOB = Date Of Birth
' varAsOf = the date to calculate the age at, or today if
missing.
'Return: Whole number of years.
Dim dtmDOB As Date
Dim dtmAsOf As Date
Dim dtmBDay As Date 'Birthday in the year of calculation.

CalcAge = Null 'Initialize to Null

'Validate parameters
If IsDate(varDOB) Then
dtmDOB = varDOB

If IsDate(varAsOf) Then 'Date to calculate age from.
dtmAsOf = varAsOf
Else
dtmAsOf = date
End If

If dtmAsOf = dtmDOB Then 'Calculate only if it's after person was
born.
dtmBDay = DateSerial(year(dtmAsOf), Month(dtmDOB), Day(dtmDOB))
CalcAge = DateDiff("yyyy", dtmDOB, dtmAsOf) + (dtmBDay dtmAsOf)
Else: CalcAge = Null 'Return Null if AsOf is before birthday
End If
End If
End Function

You can determine how many hours they are eligible for with this:

Function VacHoursEarned(intYears AS integer) As Integer

Select Case intYears
Case is 1
intYears = 40
Case is 2 To 6
intYears = 80
Case is 7 To 11
intYears = 120
Case is =12
intYears = 160
End Select
End Function




"Julie" wrote:

I have set up a table to look up for each person. Here is an example
1 year - 40 hrs
2 years - 80 hrs
7 years - 120 hrs
12 years - 160 hrs.

I have designed a form that inputs everyone's vacation for the year. I just
don't know how to get access to look at what time they have taken and deduct
it from what they were awarded for that year.

"Klatuu" wrote:

Need more information.
How do you know how much vacation an employee is eligible for?
How do you know how much they have used in the current year?

"Julie" wrote:

What I need to figure out now is how to get a query to look at their
anniversary date and add in what amount they get awarded and also to deduct
what they have taken to date. When a new employee is eligible for vacation is
on their anniversary date and then they can start taking it. So, if someone
starts in march they have to wait until the following march to use their
vacation. Can anyone help?


  #10  
Old August 16th, 2006, 08:21 PM posted to microsoft.public.access.queries
Klatuu
external usenet poster
 
Posts: 7,074
Default Vacation Query

To show the vacation earned in your text box. Make this the control souce
for the text box. It will pass the value from the Years text box to it:

=VacHoursEarned([Years])

"Secret Squirrel" wrote:

Thanks for that Klatuu but I have one more question. How do I tell this code
to look at my textbox "Years" to find out which case it falls into?

"Klatuu" wrote:

Assuming it is not a bound field (and it should not be, because it violates
the rule on storing calculated values), you can put it in the Control Source
property for the text box. To ensure the values needed are available, see
the modification below:
(Also I noticed the function had a missing line of code, so it would never
return anything

Function VacHoursEarned(varYears AS Variant) As Integer

If IsNull(varYears) Then
VacHoursEarned = Null
Exit Function
End If
Select Case varYears
Case is 1
VacHoursEarned = 40
Case is 2 To 6
VacHoursEarned = 80
Case is 7 To 11
VacHoursEarned = 120
Case is =12
VacHoursEarned = 160
End Select
End Function


"Secret Squirrel" wrote:

How do I call this function from the textbox where I want it to populate the
hours earned?

"Klatuu" wrote:

If you want to use the value in a text box, just pass the value in the text
box as the function's argument:
VacHoursEarned(Me.txtYrsService)

"Secret Squirrel" wrote:

Hi,
I want to use your function to determine the Vacation hours earned but I'm
unsure how to have it look at the textbox on my form to determine which case
it should use. Can you help shed some light on how I would set this up? I
have a form with a textbox on it that calculates a persons time of employment
from their hiredate until the present date. Now I want the data in that field
to be compared to the select case function you wrote below and have it
populate the hours earned into another textbox.
Thanks
SS

"Klatuu" wrote:

Do you have a field that shows how much time has been taken for the current
year?
There is probably a little complexity here in that your vacation allotments
are probably calculated on an employee's original hire date, but what time is
actually used is calculated on a calendar date (Jan 1 - Dec 31).

In any case, here is a function originally written to determine a person's
age as of a date. It will work for you in determining how long a person has
been employed.

Function CalcAge(varDOB As Variant, Optional varAsOf As Variant) As Variant
'Purpose: Return the Age in years.
'Arguments: varDOB = Date Of Birth
' varAsOf = the date to calculate the age at, or today if
missing.
'Return: Whole number of years.
Dim dtmDOB As Date
Dim dtmAsOf As Date
Dim dtmBDay As Date 'Birthday in the year of calculation.

CalcAge = Null 'Initialize to Null

'Validate parameters
If IsDate(varDOB) Then
dtmDOB = varDOB

If IsDate(varAsOf) Then 'Date to calculate age from.
dtmAsOf = varAsOf
Else
dtmAsOf = date
End If

If dtmAsOf = dtmDOB Then 'Calculate only if it's after person was
born.
dtmBDay = DateSerial(year(dtmAsOf), Month(dtmDOB), Day(dtmDOB))
CalcAge = DateDiff("yyyy", dtmDOB, dtmAsOf) + (dtmBDay dtmAsOf)
Else: CalcAge = Null 'Return Null if AsOf is before birthday
End If
End If
End Function

You can determine how many hours they are eligible for with this:

Function VacHoursEarned(intYears AS integer) As Integer

Select Case intYears
Case is 1
intYears = 40
Case is 2 To 6
intYears = 80
Case is 7 To 11
intYears = 120
Case is =12
intYears = 160
End Select
End Function




"Julie" wrote:

I have set up a table to look up for each person. Here is an example
1 year - 40 hrs
2 years - 80 hrs
7 years - 120 hrs
12 years - 160 hrs.

I have designed a form that inputs everyone's vacation for the year. I just
don't know how to get access to look at what time they have taken and deduct
it from what they were awarded for that year.

"Klatuu" wrote:

Need more information.
How do you know how much vacation an employee is eligible for?
How do you know how much they have used in the current year?

"Julie" wrote:

What I need to figure out now is how to get a query to look at their
anniversary date and add in what amount they get awarded and also to deduct
what they have taken to date. When a new employee is eligible for vacation is
on their anniversary date and then they can start taking it. So, if someone
starts in march they have to wait until the following march to use their
vacation. Can anyone help?


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Advanced SQL Query Wes Henry General Discussion 3 December 14th, 2005 09:55 PM
SQL query showing diff between actual and budget Bon Running & Setting Up Queries 3 August 25th, 2005 12:07 PM
Nested in-line Query laura Running & Setting Up Queries 0 February 11th, 2005 12:17 AM
Here's a shocker Mike Labosh General Discussion 2 October 26th, 2004 05:04 PM
Too Few Parameters error Mail Merge Access Parameter Query Tony_VBACoder Mailmerge 3 September 14th, 2004 12:15 PM


All times are GMT +1. The time now is 10:31 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.