Calculate A Person's Age Not Working.

Oct 11, 2006

Hi all ,
I am trying to calculate a person’s age.
Went to Customer Form
Have a field called cust_birthday ( date/time ) ( 99;00;00;>LL;0; )
Have a field called cust_age ( Number )

Went to Madules / New / then add this code,

Public Function Age(dteDOB As Date, Optional SpecDate As Variant) As Integer
Dim dteBase As Date, cust_age As Date, cust_birthday As Integer
If IsMissing(SpecDate) Then
dteBase = Date
Else
dteBase = SpecDate
End If
cust_birthday = DateDiff("yyyy", dteDOB, dteBase)
cust_age = DateSerial(Year(dteBase), Month(dteDOB), Day(dteDOB))
Age = cust_birthday + (dteBase < cust_age)
End Function


Not Working get no return. Can someone help me. Thank You if you can….

John

View Replies


ADVERTISEMENT

Field In A Database That Calculate Age Of A Person Based On DOB?

Jun 23, 2014

I need to have a field in a database that will calculate the age of a person, based on their DOB. I have it in the excel sheet that I imported into Access to create the data base, but it just copied the number that was already there. When I add new entries into the database, the age isn't calculated. How do I do this?

The forumla I use in my spreadsheet is: =DATEDIF(O2,TODAY(),"y")

View 1 Replies View Related

Calculate Working Days

May 11, 2007

I hope you can help. I have a database and I am trying to work out the working days between the start date and the end date of a programme. This will not take into account any weekends or bank holidays. I have created a separate table called tblHolidays which has a list of the Bank Holidays. The majority of it works but out of 1700 records 50 don’t. These are ones in which it starts on 1 month finished on another or has a bank holiday. It works with certain bank holidays but not all of them. Bank holidays go back to the beginning of 2006
The following is the code I have used:
Public Function WorkingDays2(Start_Date As Date, End_Date As Date) As Integer

On Error GoTo Err_WorkingDays2

Dim intCount As Integer
Dim rst As DAO.Recordset
Dim DB As DAO.Database

Set DB = CurrentDb
Set rst = DB.OpenRecordset("SELECT [HolidayDate] FROM tblHolidays", dbOpenSnapshot)

Start_Date = Start_Date + 1

intCount = 0

Do While Start_Date <= End_Date

rst.FindFirst "[HolidayDate] = #" & Start_Date & "#"
If Weekday(Start_Date) <> vbSunday And Weekday(Start_Date) <> vbSaturday Then
If rst.NoMatch Then intCount = intCount + 1
End If

Start_Date = Start_Date + 1

Loop

WorkingDays2 = intCount

Exit_WorkingDays2:
Exit Function

Err_WorkingDays2:
Select Case Err

Case Else
MsgBox Err.Description
Resume Exit_WorkingDays2
End Select

End Function

I then used the SQL

Select WorkingDays2 ([start_Date], [End_Date]) As CountDays

This is driving me crazy!!:mad:

View 12 Replies View Related

Calculate A Persons Age Code Not Working.

Oct 20, 2006

Hi all I have another code Problem, Can someone help me with this.
I have two fields
One called cust_birthday ( date field )
And one called cust_age ( text field )
The code below I put in a module name age function.

The Problem, is I get no return from this code.

What is wrong with this code ????

Option Compare Database

Public Function Age(cust_birthday As Date, Optional cust_age As Variant) As Integer
Dim dteBase As Date, intCurrent As Date, intEstAge As Integer
If IsMissing(SpecDate) Then
dteBase = Date
Else
dteBase = SpecDate
End If
cust_age = DateDiff("yyyy", dteDOB, dteBase)
cust_age = DateSerial(Year(dteBase), Month(dteDOB), Day(dteDOB))
Age = cust_birthday + (dteBase < cust_age)
End Function

John527

View 6 Replies View Related

Calculate Time Between Two Working Dates?

Oct 6, 2013

The below function returns correct time difference between workdays. However, it is excluding Saturday as per the code.

It is calculating 06:30 am to 22:00 pm time for weekdays but I also want it to calculate the time from 10:00 to 13:30 on a Saturday.

I am trying to use the NetworkMinutes function to achieve this. However, there is a problem getting the time for Saturday.

Code:
Option Compare Database
Option Explicit
'---------------------------------------------------------------------------------------
' Procedure : NetWorkMinutes
' Author : Rod
' Date : 13/12/2012
' Purpose : Returns the number of work minutes between two date-time arguments.

[code]...

View 14 Replies View Related

Calculate Working Time Between Dates In Access

Oct 26, 2006

I have searched the forum for this answer but no luck. :(

I'm trying to calculate the amount of WORKING time between two dates in an Access database. At the moment i am just subtracting one date from another but this gives me all of the time in between including weekends and evenings.

I need this time to be calculated in hours.

In Excel i know there is a NETWORKINGDAYS function which does something similar but with days rather than hours.

At least if i could get the working days i could then convert it into hours.

Please help!

View 7 Replies View Related

Forms :: Calculate Passed Working Days And Show Them In A Form

Jul 8, 2015

I need to calculate the passed working days and show them in a form. I should be also able to use the number in a query later on. in excel I use the formula to get the days passed:

Code:
=IF(ISERROR(MATCH(F10,Dictionary!C:C,0)),NETWORKDAYS(D10, TODAY(), Dictionary!$E$2:$E$43),"Status Excluded")
D = "Date_uploaded" in access table "tbl_All_Cases"
F = "Status_Case" in access table "tbl_All_Cases"
c:c = dictionary case status
E:E = dictionary holidays

"Status Excluded" will show up in the cell if a case has one of the status from the dictionary..I created a table: tbl_Dictionary where there are 2 fields: "Case_Status" and "Holidays".How can I translate the above formula into something that access will understand?

View 14 Replies View Related

Calculate Working Days Between 2 Days

Mar 14, 2006

Dear All,

I'm new to VBA coding. A code below is copied from a friend of mine and I can't make it work. How to call up this function in my form. In my form I have 3 text boxes (StartDate, EndDate and NumOfWorkDays). My form is based on a table.

Please anyone who would help me on this, kindly give me the step by step procedure as I am really novice. Thanks in advance.

'*********** Code Start **************
Public Function WorkingDays(StartDate As Date, EndDate As Date) As Integer
On Error GoTo Err_WorkingDays

Dim intCount As Integer

StartDate = StartDate + 1
'If you want to count the day of StartDate as the 1st day
'Comment out the line above

intCount = 0
Do While StartDate <= EndDate
'Make the above < and not <= to not count the EndDate

Select Case WeekDay(StartDate)
Case Is = 1, 7
intCount = intCount
Case Is = 2, 3, 4, 5, 6
intCount = intCount + 1
End Select
StartDate = StartDate + 1
Loop
WorkingDays = intCount

Exit_WorkingDays:
Exit Function

Err_WorkingDays:
Select Case Err

Case Else
MsgBox Err.Description
Resume Exit_WorkingDays
End Select

End Function
'xxxxxxxxxxxxxxxxxxxxxxxx

Can someone please direct me to the right path.

Your help is highly appreciated.

qwerty70

View 1 Replies View Related

Can More Than One Person Be Using....

Mar 25, 2008

Hi,
I've set up a database and set up User-Level security for each user.

While they are entering data, can I go in and change some items in design view?

thanks,
sjl

View 6 Replies View Related

Totals By Person

Aug 25, 2005

I have a table where 4 different people enter their amount of work sheets they complete each day via a form. Each person could have a different total each day. Example:

AJ=5
CH=10
MH=7
CA=3

Each person will have a entry for each work day of the month.

I am creating a query that needs to show each persons total for a month. I know how to get the month but how can I total each persons page count all together and then separately? Example:

All four combined total page count

AJ Page count individually
CH page count individually
MH page count individually
Ca page count individually

Thanks for all help

View 6 Replies View Related

Tracking Person's Work?

Oct 18, 2005

I'm undecided in what I should to to track what an employee does for the day. Currently employees have a 5X7 index card which is printed out fields and they fill it in by hand and turn it in.

Instead of the employees doing this I want to record all of this information in the database.

These are the fields that I will include:
EmployeeName, Book, WorkType, WorkEffort, StartPage, EndPage, StartTime, EndTime, TotalPgsWorked, Comments.

Should I bound all of these fields to the tblWorkLog or should a create unbound fields and create an append query which will add these fields to the table.

I don't want the users to enter their own start time and end time as they might not record it accurately.

Should the time be recorded this way: Have the user open the form, when the form opens that will record the start time. Have the user have the form remained open until the end of the day or when he or she finishes through out the day. When the form is closed that will record the end time.

What is an alternative of doing that though? Have the user open the form record all the info and have the startime recorded. Exit out of the database, when they finish their work, open the database go back to that record and record the end time?

My problem here would be there is no uniqe ID. The user can work on a Book for a week, and can also work on multiple books on the same day. How would they know which record to open.

I'm uncertain how to lay this out and begin it any insight will be greatly appreciated.

View 14 Replies View Related

Forms :: Only One Person In A Field

Sep 26, 2013

I have a form where one person wil insert a new record and click on a button that will display his login name and date she/he inserted the new record. A second person will later check if everything was entered correctly and this person will also press a button that will insert his login name and date in a field.The thing is that the same person can't do the quality check and insert the new record. So if in the field "PersonPassQA" is filled in and the person will do the same in "PersonQA", she/he should get a warning and the field should stay empty. This is the code I use to pass the PersonPassQA:

Code:
Private Sub Command24_Click()
'Date pass to QA and person passing to QA
Me.[DatePassedQA] = Date
Me.[PersonPassQA] = Environ("Username")
Me.Refresh
End Sub

[code]...

View 4 Replies View Related

Person Link To Adres, Howto?

Sep 1, 2005

Hello all,

I'm new here so hello everybody.

Ok, I'm pretty new to Access '97 and so I have a problem already.
I want to make an adres database. I want to make the adres central and link the persons to that adres, so that i can have multiple persons on the same adres. I created an adres table and a person table, but how do I link the person to the adres???

View 6 Replies View Related

Allowing A Database To Be Opened By More Than One Person

Apr 9, 2008

How can i have multiple people entering data into a database, also there is an excel file that imports the info every few min, if i have that open i cannot enter data into the database. theres going to about 4-5 users plus the excel file.

View 1 Replies View Related

Multiple Practice Groups For One Person

May 27, 2005

Hello,

I'm creating a simple relational database of all the attorneys our company work with. I'd like to have three tables: "Law Firms" (firm name & other info), "Attorneys" (what firm, personal info, and what practice groups s/he is involved in), and lastly "Practice Areas" (all different practice areas with codes).

Now, my issue is that people are usually involved in multiple practice areas. Thus, I can't just put a code for one practice area in "Attorneys" table, but I can't put multiple codes in either in one field (right?) because it'd mess up the relations.

What I'd like to accomplish is for people to be able to go to our intranet and, using a form (?), select a law firm and a practice group and get a list of attorneys.

Does anyone know of a good way to solve this? It doesn't have to be pretty, since the DB isn't going to be huge (2000-2500 records).

Thank you!

View 3 Replies View Related

Multiple Tables Per Person (student)

Nov 13, 2006

Hi

I have a DB for students.
I'm making notes each time we've had a chat.
Is there a possibillity to make a relationsship between 2 tables so I can make multiple records for one person? (or any other way)
For ex. 03-04-06 there were a couple of things I wrote down.
and 03-06-06 there were some other things I wrote down about the same person.
and then I will be able to backtrack this information
How do I do this.

Mikael

View 6 Replies View Related

Queries :: Concatenate Person Name And Initials

Aug 21, 2013

How to concatenate a number of fields from a table into a query.

The fields are:

Prefix
Firstname
MiddleInitial
MiddleInitial2
MiddleInitial3
Surname

Note that there will be varying combinations: some people will have a Prefix, Firstname then surname (no middle initials), so I would want to display "Mr Joe Bloggs". But others could have no Prefix but two middle initials, so "Joe P J Bloggs".

View 2 Replies View Related

General :: Moving DB To Another Person's Computer?

Dec 31, 2014

I have a search form built that depending on the dropdown selection on the form, it will run a query to SQL Server 2008 and provide data. There are 5 SQL Server db's so there are 5 different queries. I have each SQL Server linked to the Access DB. When I moved to someones else's computer I got a ODBC Call Failed message. In order to fix this, I had to recreate the links on that person's machine, then change the SQL code in the query with the new name of the linked DB.

View 4 Replies View Related

Forms :: Counting The Person Name According To A Date?

Aug 26, 2014

I have a database where I have 2 fields that are "Person Start" and "Date Start"

I would like to show in a text field how many cases a person started on a certain date or better on today's date.

I tried the below, but did not got it to work:

Code:
=Count([PersonStart]="Peter"),[DateStart]=Today())

what I'm doing wrong?

View 12 Replies View Related

Attendance Log - Missing Person(s) On Particular Date

Feb 15, 2012

I have a daily attendance tracking of 100 staff, and would like to be able to find out who was missing in particular date by running a query.

I have two tables

1) List of staff members (Name and Dept)
2) Daily log of who attended (Date, Name, Dept etc.)

View 6 Replies View Related

Query Results Multiple Records For One Person

Aug 3, 2005

I enter personnel data into a table through a form. The same person may have multiple records in the table. With each record there are yes/no boxes to be checked if that person is verified at a certain station. Let's say PERSON A has six records in the table. Let's say on one of those records he has StaPrimary yes/no box checked (or true).
I need a query to do the following: My query is to find out if any person listed in the table does not have any StaPrimary yes/no boxes checked. My dilemma is when I do the query if Person A has six records and one of the records has the StaPrimary yes/no box checked his name will still show up in the query because he has other recrods with the StaPrimary yes/no box not checked. I want to check all of each persons records in the table and if they have one StaPrimary yes/no box checked I do not want there name to show up in the query. How do I do that?

Thanks for your help

View 4 Replies View Related

Assigning More Than One Person To Specific Patient In Scheduling?

Feb 1, 2013

I am creating a scheduling database for patient home visits and need to see specific people assigned to one visit, and it will always be at least 4. Could I create a drop down list that will show all team members? How would I design the scheduling table to have multiple people for one scheduling record? I have table for Teams and one for Team members, but when creating the appointment form realized I will only see one team member assigned to one specific appointment.

View 1 Replies View Related

Multiple Work Areas In One Person Record

May 24, 2013

I have a volunteers database but some of the volunteers are working at multiple sites - how do I achieve this in access - they are appearing as multiple records at the moment

View 1 Replies View Related

How To Randomly Assign A Person Based On Entered Field In Form

Feb 10, 2015

I need to assign those appraisers to an order based on what county they cover. My main table (orders) is simple. Just an order number, order date, county and appraiser.I have a form with entry fields for all these except appraiser. I envision a "assign" button that will then pick the next appraiser in the county that was chosen. It's just a "round robin" type of thing, so the first order placed for Monroe would be assigned to ABC. The next order would be for Cecil and would assign 123. Next order for Monroe would assign DEF. I know there are many way this can be done but I've been looking at this for hours and I'm drawing a blank on the easiest way to do it.

View 5 Replies View Related

How To Split Up One Column With Multiple Rows Related To One Person Into A Query

Jul 1, 2013

I have an Access Database and I want to split up one column into multiple columns. The one column has multiple rows that relate to one person, so for instance I have the following:I am taking information from both tables and I want to create a query but I need to separate out the mother, father, and guardian with the names attached

So from the Child table :

Joe Smith Address Phone

The query that I created is from two tables, the child table and the family table: ( I used the dashes just for it to be easier to read)

------Child Table/PrimaryKey --------Family Table---------------------

First Name--- Last Name--- First Name--- Last Name--- Relationship
Joe ----------------Smith ----------Jane --------Doe-------------Mother
Joe ----------------Smith ----------John---------Smith---------- Father

So in this scenario I need to get the name of the second parent in another column....meaning have all the parents appear on the same line for this child, and each child there after..

So I need it to look like this:

------Child Table/PrimaryKey --------Family Table---------------------

First Name------ Last Name------ First Name------ Last Name------ Relationship------ 2First Name------2Last Name------2Relationship
Joe----------------Smith------------ Jane-------------- Doe------------- Mother-----------John---------------- Smith------------ Father

View 1 Replies View Related

General :: User Login Page Which Count Amount Of Time A Person Logs In

May 23, 2013

I have made a basic form and use it a log on screen. This requires the user to in put a user name and a password before gaining access to the main database.

The background to the form is a table where the users details are entered including the i enter the user name and password.

Is there any way to add a counter that is only visible in the table, so I can report on the different users.

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved