Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Calculating Age From Date In Form Field


Hello-
I have searched your forums on this and while I found several threads about calculating ages, I did not find the specific answer to my question.

I would like to type a birth date into a form field in Word, and have it calculate the age and put the answer into another field.

Thanks for your help and your patience with this beginner.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Calculating A Field In An Access Form
I have a form that one field shows the results of a function. In my form on the properties of this field I have "=SetDate()". The problem is that it is not advancing through the recordset. This field is always = Mar. For the last hour it was always=Jul. I quit using the recordsetclone and created the recordset rs. I save the month as an integer and want to display the name. This was working until I added data to another table.

Code:
function setdate()
    DateVal=Format(CDate(rs!MonthID & "/15/03"), "mmm")
end function


BTW this is the same form I discussed in my previous post.

Scott
The worst thing about wearing glasses is them being on your face.
Nothing is impossible, it just looks that way.

Automatically Calculating Age In A Text Form Field
I am trying to set up a template in Word where I can enter a birthdate into a text form field (let's name the field "DOB") and it will figure their age and place it into another text form field (let's call it "age"). I am using VB6. I know I need to use DateDiff and I know I can set a macro to run upon exiting the field DOB, but I don't know how to pull the date from the DOB field and enter the age into the age text field. Thanks in advance for helping me out.

Calculating A Date From Date And Integer
I have a base date and an offset (number of days). I need to get the date
represented by that number of days after the base date.

Date math help, please.

what I need to do is:

newdate (mm/dd/yy) = somefunction?( basedate (01/01/2000) + offset
(integer))

Mike Morrow
Acxiom Corporation
Abilitec Services Group
(501) 342-0170
mailto: email@removed
Office: CWY0204111
M/S: CWY024 - 19

Every Record Has A Date Field. I Want To Find A Date And From This Date, I Want To Read Records To E
Every record has a date field. I want to find a date and from this date, I want to read records to eof. What is the code? - Thanks

Date Calculating
Hi everyone,
I have a program that allows employees to login in and book time of work. They enter 2 days i then work out how many days they have booked off. I do this using the date difference function then i add 1. this gives me the totals days of holiday they have taken.

The problem i have is that if the user enters 2 dates and a weekend is between them (ie a friday to monday). Then I want it to exclude the weekend. so a friday to monday is 4 days but it would ony be 2 days holiday.

Is there anyway to do this?

I enter the 2 dates in the format dd/mm/yy

Thanks a lot for the help

Cheers, Adam

Calculating The End Date
I am working on an app (using Access and VB6) and on one of my forms I need to calculate the end date of a contract using the information provided by the user. On the form there is a textbox to enter the Start Date and then one to enter the number of years and one to enter the number of months (how long the contract is in effect). I then need the end date of the contract to be calculated using these variables and then have that date display in a label.

If I haven't been clear on what I am asking, please let me know. Any suggestions would be greatly appreciated (or if this is even possible - I am familiar with VB but still fairly new to it).

Thanks - Addie

Calculating Date And Time
I am writing a program where the user enters two dates and two times. e.g. 10/23/02 5:00 AM and 11/24/02 3:00 PM.
I want to take the two dates and times enterd, figure out the time interval and divide the time into 4 segments. I need to then run a query on each time segment.
I am having a lot of trouble coding this. I have changed the time to army time ( 24 hours).
Any ideas?
Thanks!

Validating / Calculating Date
Hello,


I'm having the following little Excel problem.

My worksheet has two columns, all celss defined as "Date".

Column A has dates on which a sales representative visits a certain company.

Column B has dates on which a letter has been sent to this company.

Now I want to make sure that all dates are entered corectly.

For example :
If the date value in column A is "higher" then the value in column B a message box should appear, telling the user that a wrong entry has been made.

Is there a simple way to do this using (for example) "Validating" in (Excel) VBA ?

Any help would be most welcome.
Thanks....


Frits Jager

Calculating Date Of Birth
Hi Every1,

One is a newbie at programming and wondered if anyone out there
Could , please tell me how to calculate the Date Of Birth and Output the AGE in a message box .

One is using lbl's for my input along with vsb's

lblMonth , lblDay, lblYear

One has to take into consideration when computing the D.O.B If Leap Year.

Calculating Date To Get The Age Of A Person
How to get the age of a person very accurately (yy,mm,dd,HH,mm,ss) from a dtpicker.value (birthday)

Calculating Date And Time
How do i calculate date and time in vb. What i mean is i have a date 8/27/01 5:42 PM and 9/06/01 12:32 AM, how do i find out how many day,hours,min that is.

Thanks

Date Validating And Calculating
Hi
Question:Is there a way to validate a date (Now function). ie. check its in the future and check its a possible date e.g: 45/02/03 isn't posible
Question:Can u also add ten seconds to a date (Now function) and check if its smaller or higher than another date
I am using strings in each instance but can change easily

Thanks in advance

Calculating Days From A Particular Date
Hi All,

I am trying to write some code that calculates the number of days from a particular date.

For example if the date was 08/04/2005, I want to find the previous days in that week and display them on a crystal report. So the previous days would be the 07/04/2005, 06/04/2005 and so on all the way until the monday of that week.

All help would be greatly appreciated

Kinds Regards

Sunny

Calculating Date Time Pickers
I have two time pickers where one is for employee time in and other is for employee time out..

I would like to make calculation so whe emplyee enter time in and enter time out label1.caption shows the time he spent in work ...

Can somebody help me with that...

Thanks in advance for ur help

Calculating Date & Time Differences ????
Hello all,

1:00:00 AM and 2:00:00 AM

Anyone can help to get the differences of both time in minutes ??

Thanks for advance

Calculating Year Of Age From Date Of Birth???
I've Access database with children information such as name and their data of births.

I want to use VB DataReport to report these children's info. except their data of birth, instead of reporting DOB, I want to report their ages from today date

e.g: Name-->John Doe, DOB-->02/02/2000
Then on DataReport, it doesn't give 02/02/2000 but giving "4 years old" or etc...

I don't know if any functions can do in DataReport. Please help

VB6 - Calculating 90 Days From Current Date
Gentlemen,
what is the simple way to select some records that are 90 days old from todays date?

How can I apply "DatePart" function or "DateDiff' or "DateValue".

Thanks.

Gift.

Calculating The Week Beginning Date.
Hi, I'm using the MonthView control for the first time, what I want to do is calculate the week beginning date on startup and when a person choses a date, i.e. todays date being the 29/03/2006 I need to enter the week beginning date of 27/03/2006 into a text box. I then plan to use this date to load information from an excel spreadsheet to fill in the AM and PM slots for the person, showing them their whereabouts for that week.

so if they choose another date, say 07/04/2006 it would select the week beginning 03/04/2006. Hope that makes sense and someone can show me what to do.

Regards.

Calculating Date/Time From An Offset
In C++ a time can be handled as a long from some offset date -- usually 1/1/1970.

If I have a long (which represents # of seconds since 1/1/1970
how do you convert it to a date in VB??

Thanks
David

Calculating Date Time Pickers
I have two time pickers where one is for employee time in and other is for employee time out..

I would like to make calculation so whe emplyee enter time in and enter time out label1.caption shows the time he spent in work ...

Can somebody help me with that...

Thanks in advance for ur help

Question About Calculating Date Daifference
I need to calculate difference between dates in format like this
(y-m-d) for example date1=21-may-2000
date2=18-august-2003
rezult =2year-2month-?day

Calculating Time Between A Future Date And Today
hey,
I'm stuck again!I'm a real noobie..sorry!

anyway.

i'm creating a booking appointment system and i need to calculate the time in between today and a future appointment.

i know i have to use Date Diff but have no idea on how to use it .

im using VB6 and the date is in Access and i have all the ado controls set up etc.

any help would be gratefully accepted.

Calculating A Date From Week Number & Year
I need to be able to calculate the date of every Monday depending on what week number/year it is.

For example is it possible to calculate the date (e.g. 20/10/2003) of a given day (e.g. Monday) when you only know the week number (e.g. 43) and the year (e.g. 2003)

If anyone can point me in the right direction, your help would be greatly appreciated.

Many thanks in advance

Jon

Change Date Field To A Text Field Without The Slashes
I have a field called statement date which is a date type "08/21/2008".
I want to remove the "/" from that variable. Is there an easy way to do that?

Grouping By Date Where Date Field Is Date/time
I have an SQL7 database storing datetime data, and totaliser reading, new records are added every 5 minutes.

I have written the following sql to give me the the min and max totaliser reading for each day - which works fine - except that the resultant Date field is a text field not a date field so the order statement generates an incorrect listing if the data selected sarts in one month and ends in the next, eg.

select left(Date, 12) as Date, Min(Reading) as Day_Start, Max(Reading) as Day_End from Steam where tag_no = 2 and (Date <= '24-November-2005 00:00:00' and Date >= '22-October-2005 00:00:00') Group By left(Date, 12) order by Date asc

Is there another function I can use to extract just the date from the date/time field as a date data type?

I cannot alter the database as its structure is predetermined by the remote field device supplying the data.

Excel - Calculating An End Date ( Option To Select Which Days To Count )
I've been playing around with a calendar based Date Calculator in Excel.
The problem I'am having is Calculating the End date based off information selected
and which days have been chosen to be counted.
I've attatched the spreadsheet. It's easier to look at than explain.
any ideas would be greatly appreciated!

Date Picker Control Doesn't Show Current Date In Field
How do I set the display date in the Date Picker control field ? MSDN says that it should return the current date by default, but it only shows the current date highlighted in the drop down calendar.

The control shows the date when the control was created and added to the form.

How do I set the date at form load ?


Code:
dtpicker1.value = ? ' how do I call current date ?

REQ Help: Calculating Elapsed Time From Date/time Began From Date/time Ended
I have four controls, two are Date-Time Pickers set for Date and the last two are text boxes set for Time with the "...If Not IsTime()..." validation.

It is the standard Date and Time problem began, Date and Time problem ended.

I am trying to calculate the elapsed time between these in "" DAYS "" HOURS ""MINUTES.

I coded this in Lotus Notes yet exporting my knowledge to VB is problematic.

Has anyone a code snippet of how to do this in VB - yes, I know about the DateDiff.

Many, MANY thanks!

SQL Update Subtracting Date From Date --&gt; Result Into Field
Am having a little trouble with an Update SQL statement.
The code that I have come up with is
strSql = "Update Client_Details SET Client_Details.Days_CTS= " & Date & "- ClientDCTS.M_Date ........

It will come up with the error
Disallowed implicit conversion from data type smalldatetime to data type, table FOXGUI.dbo.Client_Details', column 'Days_CTS', Use the CONVERT function to run this query
The fields data types are as follows
M_Date smalldatetime
days_CTS Int
I can understand what they mean but I just don;t know the code that I should be using.
ANyone have any ideas?

Updating Date Field With Null Value (date Picker)
Hello,

I am using VB and access. For date I am nsing date Picker. How can I update a date with null value?

I am using the code update the date field:

DateColumn=#" & Format(DTP1, "mm/dd/yyyy") & "#

When I try to udate the field with null value I receive error: syntex error in date in query expression '##'.
Please advice me how to update with null values.

Regards,
Elahi

Only Want Date Part Of Date Time Field
How can I using an SQL statement just reitrieve the date part of a database field.

The data is stored as 10 05 2001 12:31.

At moment sql is bringing back the whole field. For grouping purposes I only want the date ie 10 05 2003.

Any ideas??

Getting Numbers In Date Field Into Date Format???
in my access db i have an old table and the dates were never formatted eg its just 791023 as in 23 of oct 1979 so i had to change that to get it in date format so i did this using a query

UPDATE history_date SET history_date.theDate = format([theDate]," mm/dd/yy");

like it worked and put in the slashes but the date is different
it came out 01/25/55 when the date was originally 641027
why is it changing it ???
like i tried diff format like yy/mm/dd and still the same...
confused!!please help if u know anything...

AutoNumber Field Vs. Date Field...?
I have a database with some data. This database has a date field. When I add an AutoNumber field my data become this:


Code:
DateField AutoNumberField
01/01/2004 1
01/01/2003 2
01/01/2002 3

But I'd like to do it, sorting by date:


Code:
DateField AutoNumberField
01/01/2004 3
01/01/2003 2
01/01/2002 1

How to do it?

Thanks.

Calculating Location On The Form
I need to have scrollbars on the right and on the bottom of the window. how can I calculate location and size for scroll bars on the form if program runs in different resolutions or window resized?

Showing A Form Whilst Calculating Data ...
Afternoon all.

I have a routine I want to run once my main form has loaded (I'm using MDI forms by the way).

Basically what I want to try and do is the following :

(i) Load program and display main form
(ii) Once loaded and displayed, show another small form that basically says "Calculating Branches to Exclude"
(iii) Whilst this form is being displayed I want the program to go off and do my calculations
(iv) Once my calculations have finished I want to then remove the form and pass control back to the user.

Now ... I'm presuming that this is going to involve timers ?!
I've never designed a form that has no "focus" so am not quite sure the best way to tackle this.

Any of you guys give me a starter for 10 ?

Thanks.

Again The DATE Field !!
Good Morning Guys, again i want to disturb u all (sorry for that)

My problem is :

I have 30 date fields, if user enters date in any one or few fields, that value(s) only to be stored in tabel. All other fields to be left blank. Is it possible to do like that?

My code is......

VB Code:
Private Sub MonthView1_DateClick(ByVal DateClicked As Date)Me.Controls(strCtrl).Text = MonthView1.ValueMonthView1.Visible = FalseEnd Sub Private Sub Text1_Click()strCtrl = "Text1"MonthView1.ToolTipText = Me.Controls(strCtrl).TopMonthView1.Left = Me.Controls(strCtrl).LeftMonthView1.Visible = TrueEnd Sub Private Sub Text3_Click()strCtrl = "Text3"MonthView1.ToolTipText = Me.Controls(strCtrl).TopMonthView1.Left = Me.Controls(strCtrl).LeftMonthView1.Visible = TrueEnd SubPrivate Sub Text4_Click()strCtrl = "Text4"MonthView1.ToolTipText = Me.Controls(strCtrl).TopMonthView1.Left = Me.Controls(strCtrl).LeftMonthView1.Visible = TrueEnd Sub


The save command is :


VB Code:
Private Sub saveCmnd2_Click()Data1.Recordset.Fields("orders") = DBCombo1.TextData1.Recordset.Fields("ord_dt") = CDate(Text1.Text)Data1.Recordset.Fields("art_dt") = CDate(Text3.Text)Data1.Recordset.Fields("y_po") = CDate(Text4.Text)Data1.Recordset.UpdateEnd Sub


Please guide.

Date Field
Hi I was wondering is there a way to truncate a field which has the date and time.

example
7/8/2004 02:35:01pm

to
7/8/2004

I have a field where the user selects the date but its storing date and time. I would like to only save the date???


Rob

Date() Field
I have set a database up and require it to be run on another machine. All is fine except that the date field which I want to show the sys date come up with the error #Name?. This only happens on the second machine, all is fine when I run the Db on my machine. What could be causing this, font?

Date Field
Can anyone tell me how I would code a date of 12/01/02 to just grab the
first 2 (12) then add the (/02) to it I need to strip out the middle part?
Thanks

Getting Day In Date Field
How in Access 2000 can I get the DAY in the date field. The dates are formed EITHER 00/00/0000 or 0/00/0000. I just want the middle two for a separate day field. If I use left or right of course it won't work.

How do I use instr in an ACCESS query to pull out what is between the / 12 /. (I would just want the 12 for the day for example)?

Thanks for any direction!

Date Field
datInsuredDOB is a date
"UPDATE tblTransaction Set " & _
"Trans_dtmInsuredDOB=" & IIf(datInsuredDOB = 0, #1/1/100#, datInsuredDOB) WHERE Trans_intTransID = " & Str(m_TransID)

i check if datInsuredDOB=0 then #1/1/100# else datInsuredDOB
Why after update InsuredDOB field is =to 01/01/1900 how to put null in Date Field ????
Thanks

Date Field:
Hi,

Database Gurus, may be too naive question but facing a problem with Date field when generating report(Crystal reports) on oracle database. Since oracle stores even TIME in date data type, so when users just enter time the report displays the field as 30-dec-1899 with year as "1899".

Configuration:
Vb5.0
Nt4.0 Workstation
Oracle 7.3.4

My question is:
1)How is that for this timestamp field I am facing a problem with century?.
2)In my database tables I do have date fields but their I don't get any problem with century when printing or querying database.
3)Have any one else encountered such a problem? Am I missing something.

Any help and early reply will be much appreciated.

Regards & Thanks.

Cannot Find Field 'Date'
Hi,
I have a form in ms access.
It has a field called TicketDate and a button called GetDate.
When you click GetDate there is a onclick action defined to do the following.

TicketDate = Date

that's the whole function.

Oh noble ones please tell me why I get the error "cannot find field 'Date'"

I'm using Windows2000 pro.

Thanks,
-munch

Clear A Date Field
I have an Access field as a Date/Time type, and I have a value of 31/06/02 in there. In VB, how do I clear this field so it has nothing in it. For text fields, I can just set that field equal to "", but it doesnt seem to work for dates.

I have also tried CVDate(0), but this just sets the date equal to 0, which isnt what I want. I want the field to be emptied. The Null function also doesnt seem to want to work.

Any ideas?

Comparing A Date Field
I am trying to comapre a date coming from Access with a date value entered by a user.
I noticed that the date being entered by the user is done so via a text box, which stores the value as a String. The field in the database is a date field.
Can I compare these values the way they are, or do I have to move the date field into a string field or vice versa?
The reason I ask is because when the code to compare the dates
runs nothing seems to work.
Here's a generic example.

Lets say FileDate = 01/01/2001
Lets Say PromptDate = "01/01/2001"

If FileDate = PromptDate Then
msgbox " The dates are equal"
Else
msgbox " The dates are not equal"
End If

If this code was in my program, I would always get the message saying "The Dates are not equal"

Is there a way to better compare dates?

Querying A Date Field
Hello I am trying to construct a query to query a datefield in access.

if i use '<' or ' >' then the query works fine.But if i use = it dosent give me any accurate reults. Any idea why ?

My query is
Select * from Deal where Marketer='Z03986' AND TransactionDate< #7/18/2003#

This works but if i substitute < with = it dosent work.

thanks
Sam

How To Ask A For A Date In A Recordsetīs Field ??
Hola,

I tried this in an Access 2002 Modul, to ask for a special date, in a special ADODB.Recordset:

rstPAM.MoveFirst

For i = 0 To rstPAM.RecordCount - 1

WV = Format(rstPAM!Wiedervorlage, "dd.mm.yyyy")

If WV = '01.01.2001' Then

rstPAM!Wiedervorlage = Null

End If

rstPAM.MoveNext
Next

But the If - clasue is always wrong. I donīt know what to do !! I couldnīt find anything in MSDN or the Forum.

Please help

CR9-DDF Date Field Problem?
CR9-DDF date field problem?
-----------------------------
Hi

I designed a report using Data Definition File. I put date field during design time. But, during runtime date field is not showing data from recordset. Other fields are fine.

How to use date field from DDF, without getting problem during run-time?

Date Time Field
I have a table field that store date and time in the format of yyyy/mm/dd hh:mm:ss, how can i select the date only ?

Copyright Đ 2005-08 www.BigResource.com, All rights reserved