access_learner
Registered User.
- Local time
- Today, 13:07
- Joined
- Oct 5, 2004
- Messages
- 13
hey hey.
i posted this in the general section ut didnt get any responses.
now ive been thinking about it and i think it could be done in the coded area.
I am generating statistics from my table data.
gender, ethnicity etc etc.
i want to add Age to this.
however because im not storing Age, im calculating it from DOB i cant do it.
this is the code im using to generate the stats
im thinking that i could add something to this code like
if (field selected = DOB){
then =DateDiff("yyyy",[DOB],Date())+(Date()<DateSerial(Year(Date()),Month([DOB]),Day([DOB])))
}
i dont know VB, nor how i would code this.
but is my theory correct ?
when someone selects DOB from the list, because it is a stored value, and then could i run DOB through the same Age forumla i use to calculate the Age and display the differnt DOB's but as an Age. ??
i hope someone can help me with this.
cheers.
ACCESS_LEARNER
i posted this in the general section ut didnt get any responses.
now ive been thinking about it and i think it could be done in the coded area.
I am generating statistics from my table data.
gender, ethnicity etc etc.
i want to add Age to this.
however because im not storing Age, im calculating it from DOB i cant do it.
this is the code im using to generate the stats
Code:
Private Sub cboFields_AfterUpdate()
Dim iTotalStudents As Integer
Dim SQL As String
iTotalStudents = DCount("*", "Students")
SQL = "Select nz([Students].[" & Me.cboFields & "]," & _
IIf(Me.cboFields = "Completed College", _
"'Not Completed'", "'Not Specified'") & ")" & _
", Format(Count(*)/" & iTotalStudents & ",'Percent')" & _
" from [Students]" & _
" Group By [" & Me.cboFields & "]"
Me.lblStatistics.Caption = Me.cboFields
Me.lstStatistics.RowSource = SQL
End Sub
im thinking that i could add something to this code like
if (field selected = DOB){
then =DateDiff("yyyy",[DOB],Date())+(Date()<DateSerial(Year(Date()),Month([DOB]),Day([DOB])))
}
i dont know VB, nor how i would code this.
but is my theory correct ?
when someone selects DOB from the list, because it is a stored value, and then could i run DOB through the same Age forumla i use to calculate the Age and display the differnt DOB's but as an Age. ??
i hope someone can help me with this.
cheers.
ACCESS_LEARNER