Search results for query: calculate age

  1. arnelgp

    Solved Update Query Based on Columns in Another Table

    you can remove the [Age in Days] and [Age Range] fields from Person_Details table since you can calculate it using Query: here is your Query: Select [Person ID], [Date of birth], Date() - [Date of birth] As [Age in days], (Select [Age Range] From [Age_Range]...
  2. arnelgp

    Solved how to get AGE from my idenfication no format

    it is evaluating 03 as 2003 and the calculation is Correct, 19. if the real Age is 29, the first 2 digit should be "93" (1993)? what do you think? look at your sample on post #1. if this is not the case, then you cannot say that the first 2 digit is the Year.
  3. arnelgp

    query calculates the age

    you can also Change your fnAge() function to handle Null: Function fnAge(dtmBD As Variant, Optional dtmDate As Date = 1) _ As Variant ' Calculate a person's age, given the person's birth date and ' an optional "current" date. If IsNull(dtmBD) Or Not (IsDate(dtmBD)) Then Exit...
  4. arnelgp

    Access for dummies - Calculating current age

    you get Today's date by using Date() function. here is a function, you copy in Standard Module: create a Query to call the function: select applicantTable.ID, applicantTable.Name, applicantTable.DOB, fnAge([DOB], Date()) As Age from applicantTable; Function fnAge(dtmBD As Date, Optional...
  5. arnelgp

    Analysing Data from List Box

    you can try to add a Calculated field on your query. on your first post there is Age column there: Field: Format(Age, "yyyymm") Table: Total: Group Show: no Sort: Ascending
  6. arnelgp

    Age field in form

    re-create your query and add the calculated Age column: select *, DateDiff("yyyy", [dateField], Date) As Age from tableName; use the query as the Recordsource of your table. add the Age column to your form.
  7. arnelgp

    Help with IF and AND in a query

    as suggested, create a table for your age category: tblAgeCat: Cat | LoAge | HiAge A | 25 | 100 B | 19 | 24 D | 16 | 18 E | 12 | 15 F | 0 | 11...
  8. arnelgp

    Calculate age

    Re: Calculate age - needed quickly put this in a module: Function fnAge(dtmBD As Date, Optional dtmDate As Date = 0) _ As Integer ' Calculate a person's age, given the person's birth date and ' an optional "current" date. If dtmDate = 0 Then ' Did the caller pass in a...
  9. arnelgp

    Calculate age

    Re: Calculate age - needed quickly here is the fix: Function fnAge(dtmBD As Variant, Optional dtmDate As Date = 0) _ As Variant ' Calculate a person's age, given the person's birth date and ' an optional "current" date. If IsNull(dtmBD) Then Exit Function If Not IsDate(dtmBD)...
  10. arnelgp

    Calculate age

    Re: Calculate age - needed quickly remove module2, the code is already saved in module1 that is why it is complaining. on vbe, right click module2 and choose remove.
  11. arnelgp

    displayin current age in a table field

    put in module: on your query: Age:AgeYears([date of birth field] Function AgeYear(dtmBD As Date, Optional dtmDate As Date = 0) _ As Integer ' Calculate a person's age, given the person's birth date and ' an optional "current" date. If dtmDate = 0 Then ' Did the caller...
  12. arnelgp

    Formula to Show Years and Months of Service

    Function fnAge2(dtmBD As Date, Optional dtmDate As Date = 0) _ As Double ' Calculate a person's age, given the person's birth date and ' an optional "current" date. If dtmDate = 0 Then ' Did the caller pass in a date? If not, use ' the current date. dtmDate =...
  13. arnelgp

    Calculating Length of Service where one field has a Null Value

    from: http://www.vbaexpress.com/kb/getarticle.php?kb_id=866 Option Compare Database Option Explicit Function YearsMonthsDays(Date1 As Date, Optional Date2 As Date = 0, Optional ShowAll As _ Boolean = False, Optional Grammar As Boolean = True) ' This function returns a string "X...
Top Bottom