Calculating Dates

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a database to track employee required training. One form has 4 fields:
course, completion date, CLUs Earned, CLUs in past 24 months. I want to have
a text box or (not sure) field that will calculate how many CLUs have been
earned in total during the past 24 months only. So, when I open my
switchboard, the main form Employees, will display how many CLUs this
employee has in the past 24 months. I also would like to comment that these
community webpages have been so much help to me in the last year as I built 4
databases. All the helpers are great!! Thank you ahead of time for any and
all help.
 
Not sure if I'll get the fields correct, but I think you want to use DSum:
DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & " AND
[Completion Date] > #" & DateAdd("yyyy",-2, Date()) & "#")

HTH,
Barry
 
Just in case the user has his/her Short Date format set to other than
mm/dd/yyyy, that would be safer as

DSum("[CLUsEarned]","MyTable", _
"[Employee] = " & Me.txtEmployee & _
" AND [Completion Date] > " & _
Format(DateAdd("yyyy",-2, Date()), "\#mm\/dd\/yyyy\#")


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Barry Gilbert said:
Not sure if I'll get the fields correct, but I think you want to use DSum:
DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & " AND
[Completion Date] > #" & DateAdd("yyyy",-2, Date()) & "#")

HTH,
Barry

Jan said:
I have a database to track employee required training. One form has 4 fields:
course, completion date, CLUs Earned, CLUs in past 24 months. I want to have
a text box or (not sure) field that will calculate how many CLUs have been
earned in total during the past 24 months only. So, when I open my
switchboard, the main form Employees, will display how many CLUs this
employee has in the past 24 months. I also would like to comment that these
community webpages have been so much help to me in the last year as I built 4
databases. All the helpers are great!! Thank you ahead of time for any and
all help.
 
But where does this formula go? Do I add a text box and use properties and
event procedure... I don't understand. I'll try it in a text box and see.

Barry Gilbert said:
Not sure if I'll get the fields correct, but I think you want to use DSum:
DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & " AND
[Completion Date] > #" & DateAdd("yyyy",-2, Date()) & "#")

HTH,
Barry

Jan said:
I have a database to track employee required training. One form has 4 fields:
course, completion date, CLUs Earned, CLUs in past 24 months. I want to have
a text box or (not sure) field that will calculate how many CLUs have been
earned in total during the past 24 months only. So, when I open my
switchboard, the main form Employees, will display how many CLUs this
employee has in the past 24 months. I also would like to comment that these
community webpages have been so much help to me in the last year as I built 4
databases. All the helpers are great!! Thank you ahead of time for any and
all help.
 
I must be doing something wrong... the text box shows #NAME? For "MyTable" I
put in the actual name of my table

Douglas J Steele said:
Just in case the user has his/her Short Date format set to other than
mm/dd/yyyy, that would be safer as

DSum("[CLUsEarned]","MyTable", _
"[Employee] = " & Me.txtEmployee & _
" AND [Completion Date] > " & _
Format(DateAdd("yyyy",-2, Date()), "\#mm\/dd\/yyyy\#")


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Barry Gilbert said:
Not sure if I'll get the fields correct, but I think you want to use DSum:
DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & " AND
[Completion Date] > #" & DateAdd("yyyy",-2, Date()) & "#")

HTH,
Barry

Jan said:
I have a database to track employee required training. One form has 4 fields:
course, completion date, CLUs Earned, CLUs in past 24 months. I want to have
a text box or (not sure) field that will calculate how many CLUs have been
earned in total during the past 24 months only. So, when I open my
switchboard, the main form Employees, will display how many CLUs this
employee has in the past 24 months. I also would like to comment that these
community webpages have been so much help to me in the last year as I built 4
databases. All the helpers are great!! Thank you ahead of time for any and
all help.
 
Put it in the ControlSource property of a textbox, preceded by "=".

Barry

Jan said:
But where does this formula go? Do I add a text box and use properties and
event procedure... I don't understand. I'll try it in a text box and see.

Barry Gilbert said:
Not sure if I'll get the fields correct, but I think you want to use DSum:
DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & " AND
[Completion Date] > #" & DateAdd("yyyy",-2, Date()) & "#")

HTH,
Barry

Jan said:
I have a database to track employee required training. One form has 4 fields:
course, completion date, CLUs Earned, CLUs in past 24 months. I want to have
a text box or (not sure) field that will calculate how many CLUs have been
earned in total during the past 24 months only. So, when I open my
switchboard, the main form Employees, will display how many CLUs this
employee has in the past 24 months. I also would like to comment that these
community webpages have been so much help to me in the last year as I built 4
databases. All the helpers are great!! Thank you ahead of time for any and
all help.
 
Shoot Barry... I did it, here it is pasted in case I've done something stupid:
=DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & "AND
[Completion Date] > #" & DateAdd("yyyy",-2,Date()) & "#")

When I go to form view to take a look, the text box reads #Name? Any ideas?

Barry Gilbert said:
Put it in the ControlSource property of a textbox, preceded by "=".

Barry

Jan said:
But where does this formula go? Do I add a text box and use properties and
event procedure... I don't understand. I'll try it in a text box and see.

Barry Gilbert said:
Not sure if I'll get the fields correct, but I think you want to use DSum:
DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & " AND
[Completion Date] > #" & DateAdd("yyyy",-2, Date()) & "#")

HTH,
Barry

:

I have a database to track employee required training. One form has 4 fields:
course, completion date, CLUs Earned, CLUs in past 24 months. I want to have
a text box or (not sure) field that will calculate how many CLUs have been
earned in total during the past 24 months only. So, when I open my
switchboard, the main form Employees, will display how many CLUs this
employee has in the past 24 months. I also would like to comment that these
community webpages have been so much help to me in the last year as I built 4
databases. All the helpers are great!! Thank you ahead of time for any and
all help.
 
Is your table actually named MyTable?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Jan said:
Shoot Barry... I did it, here it is pasted in case I've done something stupid:
=DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & "AND
[Completion Date] > #" & DateAdd("yyyy",-2,Date()) & "#")

When I go to form view to take a look, the text box reads #Name? Any ideas?

Barry Gilbert said:
Put it in the ControlSource property of a textbox, preceded by "=".

Barry

Jan said:
But where does this formula go? Do I add a text box and use properties and
event procedure... I don't understand. I'll try it in a text box and see.

:

Not sure if I'll get the fields correct, but I think you want to use DSum:
DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & " AND
[Completion Date] > #" & DateAdd("yyyy",-2, Date()) & "#")

HTH,
Barry

:

I have a database to track employee required training. One form has 4 fields:
course, completion date, CLUs Earned, CLUs in past 24 months. I want to have
a text box or (not sure) field that will calculate how many CLUs have been
earned in total during the past 24 months only. So, when I open my
switchboard, the main form Employees, will display how many CLUs this
employee has in the past 24 months. I also would like to comment that these
community webpages have been so much help to me in the last year as I built 4
databases. All the helpers are great!! Thank you ahead of time for any and
all help.
 
Is this exactly what you put in your ControlSource? If so, you need to
replace the field names, controls, and table name with the ones in your db.
Also, my example assumes that your employee field is numeric. If it's text,
change it like so:

","[Employee] = '" & Me.txtEmployee & "' AND ...
(notice the extra single quotes?)

Barry

Jan said:
Shoot Barry... I did it, here it is pasted in case I've done something stupid:
=DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & "AND
[Completion Date] > #" & DateAdd("yyyy",-2,Date()) & "#")

When I go to form view to take a look, the text box reads #Name? Any ideas?

Barry Gilbert said:
Put it in the ControlSource property of a textbox, preceded by "=".

Barry

Jan said:
But where does this formula go? Do I add a text box and use properties and
event procedure... I don't understand. I'll try it in a text box and see.

:

Not sure if I'll get the fields correct, but I think you want to use DSum:
DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & " AND
[Completion Date] > #" & DateAdd("yyyy",-2, Date()) & "#")

HTH,
Barry

:

I have a database to track employee required training. One form has 4 fields:
course, completion date, CLUs Earned, CLUs in past 24 months. I want to have
a text box or (not sure) field that will calculate how many CLUs have been
earned in total during the past 24 months only. So, when I open my
switchboard, the main form Employees, will display how many CLUs this
employee has in the past 24 months. I also would like to comment that these
community webpages have been so much help to me in the last year as I built 4
databases. All the helpers are great!! Thank you ahead of time for any and
all help.
 
Barry, I'm a mess... =( Here is how I have it now.. however, you said to
preceed it with an equal sign but when I do it tells me I have too many
arguments:
DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "'AND [Completion Date] > #" & DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#")
FYI: CLUs Earned is the name of a field in the Mandatory Continued Learning
Units Table, SSN is what I use to relate all the tables so I can track all
information in various forms and completion date is the name of another field
in Mandatory Cont... Units Table. Still returning #Name? What do you think
now?


Barry Gilbert said:
Is this exactly what you put in your ControlSource? If so, you need to
replace the field names, controls, and table name with the ones in your db.
Also, my example assumes that your employee field is numeric. If it's text,
change it like so:

","[Employee] = '" & Me.txtEmployee & "' AND ...
(notice the extra single quotes?)

Barry

Jan said:
Shoot Barry... I did it, here it is pasted in case I've done something stupid:
=DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & "AND
[Completion Date] > #" & DateAdd("yyyy",-2,Date()) & "#")

When I go to form view to take a look, the text box reads #Name? Any ideas?

Barry Gilbert said:
Put it in the ControlSource property of a textbox, preceded by "=".

Barry

:

But where does this formula go? Do I add a text box and use properties and
event procedure... I don't understand. I'll try it in a text box and see.

:

Not sure if I'll get the fields correct, but I think you want to use DSum:
DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & " AND
[Completion Date] > #" & DateAdd("yyyy",-2, Date()) & "#")

HTH,
Barry

:

I have a database to track employee required training. One form has 4 fields:
course, completion date, CLUs Earned, CLUs in past 24 months. I want to have
a text box or (not sure) field that will calculate how many CLUs have been
earned in total during the past 24 months only. So, when I open my
switchboard, the main form Employees, will display how many CLUs this
employee has in the past 24 months. I also would like to comment that these
community webpages have been so much help to me in the last year as I built 4
databases. All the helpers are great!! Thank you ahead of time for any and
all help.
 
If you plan to use Doug's suggestion, you left off the Format function:

=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" & Format(DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#"))

Barry

Jan said:
Barry, I'm a mess... =( Here is how I have it now.. however, you said to
preceed it with an equal sign but when I do it tells me I have too many
arguments:
DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "'AND [Completion Date] > #" & DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#")
FYI: CLUs Earned is the name of a field in the Mandatory Continued Learning
Units Table, SSN is what I use to relate all the tables so I can track all
information in various forms and completion date is the name of another field
in Mandatory Cont... Units Table. Still returning #Name? What do you think
now?


Barry Gilbert said:
Is this exactly what you put in your ControlSource? If so, you need to
replace the field names, controls, and table name with the ones in your db.
Also, my example assumes that your employee field is numeric. If it's text,
change it like so:

","[Employee] = '" & Me.txtEmployee & "' AND ...
(notice the extra single quotes?)

Barry

Jan said:
Shoot Barry... I did it, here it is pasted in case I've done something stupid:
=DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & "AND
[Completion Date] > #" & DateAdd("yyyy",-2,Date()) & "#")

When I go to form view to take a look, the text box reads #Name? Any ideas?

:

Put it in the ControlSource property of a textbox, preceded by "=".

Barry

:

But where does this formula go? Do I add a text box and use properties and
event procedure... I don't understand. I'll try it in a text box and see.

:

Not sure if I'll get the fields correct, but I think you want to use DSum:
DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & " AND
[Completion Date] > #" & DateAdd("yyyy",-2, Date()) & "#")

HTH,
Barry

:

I have a database to track employee required training. One form has 4 fields:
course, completion date, CLUs Earned, CLUs in past 24 months. I want to have
a text box or (not sure) field that will calculate how many CLUs have been
earned in total during the past 24 months only. So, when I open my
switchboard, the main form Employees, will display how many CLUs this
employee has in the past 24 months. I also would like to comment that these
community webpages have been so much help to me in the last year as I built 4
databases. All the helpers are great!! Thank you ahead of time for any and
all help.
 
I'm still getting #Name? Here it is:
=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" &
Format(DateAdd("yyyy",-2,Date()),"\#mm\/dd\/yyyy\#"))
What is wrong now?
Jan

Barry Gilbert said:
If you plan to use Doug's suggestion, you left off the Format function:

=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" & Format(DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#"))

Barry

Jan said:
Barry, I'm a mess... =( Here is how I have it now.. however, you said to
preceed it with an equal sign but when I do it tells me I have too many
arguments:
DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "'AND [Completion Date] > #" & DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#")
FYI: CLUs Earned is the name of a field in the Mandatory Continued Learning
Units Table, SSN is what I use to relate all the tables so I can track all
information in various forms and completion date is the name of another field
in Mandatory Cont... Units Table. Still returning #Name? What do you think
now?


Barry Gilbert said:
Is this exactly what you put in your ControlSource? If so, you need to
replace the field names, controls, and table name with the ones in your db.
Also, my example assumes that your employee field is numeric. If it's text,
change it like so:

","[Employee] = '" & Me.txtEmployee & "' AND ...
(notice the extra single quotes?)

Barry

:

Shoot Barry... I did it, here it is pasted in case I've done something stupid:
=DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & "AND
[Completion Date] > #" & DateAdd("yyyy",-2,Date()) & "#")

When I go to form view to take a look, the text box reads #Name? Any ideas?

:

Put it in the ControlSource property of a textbox, preceded by "=".

Barry

:

But where does this formula go? Do I add a text box and use properties and
event procedure... I don't understand. I'll try it in a text box and see.

:

Not sure if I'll get the fields correct, but I think you want to use DSum:
DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & " AND
[Completion Date] > #" & DateAdd("yyyy",-2, Date()) & "#")

HTH,
Barry

:

I have a database to track employee required training. One form has 4 fields:
course, completion date, CLUs Earned, CLUs in past 24 months. I want to have
a text box or (not sure) field that will calculate how many CLUs have been
earned in total during the past 24 months only. So, when I open my
switchboard, the main form Employees, will display how many CLUs this
employee has in the past 24 months. I also would like to comment that these
community webpages have been so much help to me in the last year as I built 4
databases. All the helpers are great!! Thank you ahead of time for any and
all help.
 
Jan,

Please confirm that the SSN field in your table is a text field.
Barry

Jan said:
I'm still getting #Name? Here it is:
=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" &
Format(DateAdd("yyyy",-2,Date()),"\#mm\/dd\/yyyy\#"))
What is wrong now?
Jan

Barry Gilbert said:
If you plan to use Doug's suggestion, you left off the Format function:

=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" & Format(DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#"))

Barry

Jan said:
Barry, I'm a mess... =( Here is how I have it now.. however, you said to
preceed it with an equal sign but when I do it tells me I have too many
arguments:
DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "'AND [Completion Date] > #" & DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#")
FYI: CLUs Earned is the name of a field in the Mandatory Continued Learning
Units Table, SSN is what I use to relate all the tables so I can track all
information in various forms and completion date is the name of another field
in Mandatory Cont... Units Table. Still returning #Name? What do you think
now?


:

Is this exactly what you put in your ControlSource? If so, you need to
replace the field names, controls, and table name with the ones in your db.
Also, my example assumes that your employee field is numeric. If it's text,
change it like so:

","[Employee] = '" & Me.txtEmployee & "' AND ...
(notice the extra single quotes?)

Barry

:

Shoot Barry... I did it, here it is pasted in case I've done something stupid:
=DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & "AND
[Completion Date] > #" & DateAdd("yyyy",-2,Date()) & "#")

When I go to form view to take a look, the text box reads #Name? Any ideas?

:

Put it in the ControlSource property of a textbox, preceded by "=".

Barry

:

But where does this formula go? Do I add a text box and use properties and
event procedure... I don't understand. I'll try it in a text box and see.

:

Not sure if I'll get the fields correct, but I think you want to use DSum:
DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & " AND
[Completion Date] > #" & DateAdd("yyyy",-2, Date()) & "#")

HTH,
Barry

:

I have a database to track employee required training. One form has 4 fields:
course, completion date, CLUs Earned, CLUs in past 24 months. I want to have
a text box or (not sure) field that will calculate how many CLUs have been
earned in total during the past 24 months only. So, when I open my
switchboard, the main form Employees, will display how many CLUs this
employee has in the past 24 months. I also would like to comment that these
community webpages have been so much help to me in the last year as I built 4
databases. All the helpers are great!! Thank you ahead of time for any and
all help.
 
Yes, it is a text field... I have an input mask though.. for a SSN.
Jan

Barry Gilbert said:
Jan,

Please confirm that the SSN field in your table is a text field.
Barry

Jan said:
I'm still getting #Name? Here it is:
=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" &
Format(DateAdd("yyyy",-2,Date()),"\#mm\/dd\/yyyy\#"))
What is wrong now?
Jan

Barry Gilbert said:
If you plan to use Doug's suggestion, you left off the Format function:

=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" & Format(DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#"))

Barry

:

Barry, I'm a mess... =( Here is how I have it now.. however, you said to
preceed it with an equal sign but when I do it tells me I have too many
arguments:
DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "'AND [Completion Date] > #" & DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#")
FYI: CLUs Earned is the name of a field in the Mandatory Continued Learning
Units Table, SSN is what I use to relate all the tables so I can track all
information in various forms and completion date is the name of another field
in Mandatory Cont... Units Table. Still returning #Name? What do you think
now?


:

Is this exactly what you put in your ControlSource? If so, you need to
replace the field names, controls, and table name with the ones in your db.
Also, my example assumes that your employee field is numeric. If it's text,
change it like so:

","[Employee] = '" & Me.txtEmployee & "' AND ...
(notice the extra single quotes?)

Barry

:

Shoot Barry... I did it, here it is pasted in case I've done something stupid:
=DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & "AND
[Completion Date] > #" & DateAdd("yyyy",-2,Date()) & "#")

When I go to form view to take a look, the text box reads #Name? Any ideas?

:

Put it in the ControlSource property of a textbox, preceded by "=".

Barry

:

But where does this formula go? Do I add a text box and use properties and
event procedure... I don't understand. I'll try it in a text box and see.

:

Not sure if I'll get the fields correct, but I think you want to use DSum:
DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & " AND
[Completion Date] > #" & DateAdd("yyyy",-2, Date()) & "#")

HTH,
Barry

:

I have a database to track employee required training. One form has 4 fields:
course, completion date, CLUs Earned, CLUs in past 24 months. I want to have
a text box or (not sure) field that will calculate how many CLUs have been
earned in total during the past 24 months only. So, when I open my
switchboard, the main form Employees, will display how many CLUs this
employee has in the past 24 months. I also would like to comment that these
community webpages have been so much help to me in the last year as I built 4
databases. All the helpers are great!! Thank you ahead of time for any and
all help.
 
Ok. Let's simplify it a bit by taking out the format statement:

=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" & DateAdd("yyyy",-2,Date()) & "#")

Barry

Jan said:
Yes, it is a text field... I have an input mask though.. for a SSN.
Jan

Barry Gilbert said:
Jan,

Please confirm that the SSN field in your table is a text field.
Barry

Jan said:
I'm still getting #Name? Here it is:
=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" &
Format(DateAdd("yyyy",-2,Date()),"\#mm\/dd\/yyyy\#"))
What is wrong now?
Jan

:

If you plan to use Doug's suggestion, you left off the Format function:

=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" & Format(DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#"))

Barry

:

Barry, I'm a mess... =( Here is how I have it now.. however, you said to
preceed it with an equal sign but when I do it tells me I have too many
arguments:
DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "'AND [Completion Date] > #" & DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#")
FYI: CLUs Earned is the name of a field in the Mandatory Continued Learning
Units Table, SSN is what I use to relate all the tables so I can track all
information in various forms and completion date is the name of another field
in Mandatory Cont... Units Table. Still returning #Name? What do you think
now?


:

Is this exactly what you put in your ControlSource? If so, you need to
replace the field names, controls, and table name with the ones in your db.
Also, my example assumes that your employee field is numeric. If it's text,
change it like so:

","[Employee] = '" & Me.txtEmployee & "' AND ...
(notice the extra single quotes?)

Barry

:

Shoot Barry... I did it, here it is pasted in case I've done something stupid:
=DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & "AND
[Completion Date] > #" & DateAdd("yyyy",-2,Date()) & "#")

When I go to form view to take a look, the text box reads #Name? Any ideas?

:

Put it in the ControlSource property of a textbox, preceded by "=".

Barry

:

But where does this formula go? Do I add a text box and use properties and
event procedure... I don't understand. I'll try it in a text box and see.

:

Not sure if I'll get the fields correct, but I think you want to use DSum:
DSum("[CLUsEarned]","MyTable","[Employee] = " & Me.txtEmployee & " AND
[Completion Date] > #" & DateAdd("yyyy",-2, Date()) & "#")

HTH,
Barry

:

I have a database to track employee required training. One form has 4 fields:
course, completion date, CLUs Earned, CLUs in past 24 months. I want to have
a text box or (not sure) field that will calculate how many CLUs have been
earned in total during the past 24 months only. So, when I open my
switchboard, the main form Employees, will display how many CLUs this
employee has in the past 24 months. I also would like to comment that these
community webpages have been so much help to me in the last year as I built 4
databases. All the helpers are great!! Thank you ahead of time for any and
all help.
 
Actually, square brackets are required around the table name, because of the
spaces in its name:

=DSum("[CLUs Earned]","[Mandatory Continued Learning Units]","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" & DateAdd("yyyy",-2,Date()) &
"#")


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Barry Gilbert said:
Ok. Let's simplify it a bit by taking out the format statement:

=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" & DateAdd("yyyy",-2,Date()) &
"#")

Barry

Jan said:
Yes, it is a text field... I have an input mask though.. for a SSN.
Jan

Barry Gilbert said:
Jan,

Please confirm that the SSN field in your table is a text field.
Barry

:

I'm still getting #Name? Here it is:
=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] =
'" &
Me.txtSSN & "' AND [Completion Date] > #" &
Format(DateAdd("yyyy",-2,Date()),"\#mm\/dd\/yyyy\#"))
What is wrong now?
Jan

:

If you plan to use Doug's suggestion, you left off the Format
function:

=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] =
'" &
Me.txtSSN & "' AND [Completion Date] > #" &
Format(DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#"))

Barry

:

Barry, I'm a mess... =( Here is how I have it now.. however,
you said to
preceed it with an equal sign but when I do it tells me I have
too many
arguments:
DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN]
= '" &
Me.txtSSN & "'AND [Completion Date] > #" &
DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#")
FYI: CLUs Earned is the name of a field in the Mandatory
Continued Learning
Units Table, SSN is what I use to relate all the tables so I can
track all
information in various forms and completion date is the name of
another field
in Mandatory Cont... Units Table. Still returning #Name? What
do you think
now?


:

Is this exactly what you put in your ControlSource? If so, you
need to
replace the field names, controls, and table name with the ones
in your db.
Also, my example assumes that your employee field is numeric.
If it's text,
change it like so:

","[Employee] = '" & Me.txtEmployee & "' AND ...
(notice the extra single quotes?)

Barry

:

Shoot Barry... I did it, here it is pasted in case I've done
something stupid:
=DSum("[CLUsEarned]","MyTable","[Employee] = " &
Me.txtEmployee & "AND
[Completion Date] > #" & DateAdd("yyyy",-2,Date()) & "#")

When I go to form view to take a look, the text box reads
#Name? Any ideas?

:

Put it in the ControlSource property of a textbox, preceded
by "=".

Barry

:

But where does this formula go? Do I add a text box and
use properties and
event procedure... I don't understand. I'll try it in a
text box and see.

:

Not sure if I'll get the fields correct, but I think
you want to use DSum:
DSum("[CLUsEarned]","MyTable","[Employee] = " &
Me.txtEmployee & " AND
[Completion Date] > #" & DateAdd("yyyy",-2, Date()) &
"#")

HTH,
Barry

:

I have a database to track employee required
training. One form has 4 fields:
course, completion date, CLUs Earned, CLUs in past 24
months. I want to have
a text box or (not sure) field that will calculate
how many CLUs have been
earned in total during the past 24 months only. So,
when I open my
switchboard, the main form Employees, will display
how many CLUs this
employee has in the past 24 months. I also would like
to comment that these
community webpages have been so much help to me in
the last year as I built 4
databases. All the helpers are great!! Thank you
ahead of time for any and
all help.
 
Let this be a lesson to all of you
space-within-table-name-or-field-name-putting developers out there! Good
catch.

Douglas J. Steele said:
Actually, square brackets are required around the table name, because of the
spaces in its name:

=DSum("[CLUs Earned]","[Mandatory Continued Learning Units]","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" & DateAdd("yyyy",-2,Date()) &
"#")


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Barry Gilbert said:
Ok. Let's simplify it a bit by taking out the format statement:

=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" & DateAdd("yyyy",-2,Date()) &
"#")

Barry

Jan said:
Yes, it is a text field... I have an input mask though.. for a SSN.
Jan

:

Jan,

Please confirm that the SSN field in your table is a text field.
Barry

:

I'm still getting #Name? Here it is:
=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] =
'" &
Me.txtSSN & "' AND [Completion Date] > #" &
Format(DateAdd("yyyy",-2,Date()),"\#mm\/dd\/yyyy\#"))
What is wrong now?
Jan

:

If you plan to use Doug's suggestion, you left off the Format
function:

=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] =
'" &
Me.txtSSN & "' AND [Completion Date] > #" &
Format(DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#"))

Barry

:

Barry, I'm a mess... =( Here is how I have it now.. however,
you said to
preceed it with an equal sign but when I do it tells me I have
too many
arguments:
DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN]
= '" &
Me.txtSSN & "'AND [Completion Date] > #" &
DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#")
FYI: CLUs Earned is the name of a field in the Mandatory
Continued Learning
Units Table, SSN is what I use to relate all the tables so I can
track all
information in various forms and completion date is the name of
another field
in Mandatory Cont... Units Table. Still returning #Name? What
do you think
now?


:

Is this exactly what you put in your ControlSource? If so, you
need to
replace the field names, controls, and table name with the ones
in your db.
Also, my example assumes that your employee field is numeric.
If it's text,
change it like so:

","[Employee] = '" & Me.txtEmployee & "' AND ...
(notice the extra single quotes?)

Barry

:

Shoot Barry... I did it, here it is pasted in case I've done
something stupid:
=DSum("[CLUsEarned]","MyTable","[Employee] = " &
Me.txtEmployee & "AND
[Completion Date] > #" & DateAdd("yyyy",-2,Date()) & "#")

When I go to form view to take a look, the text box reads
#Name? Any ideas?

:

Put it in the ControlSource property of a textbox, preceded
by "=".

Barry

:

But where does this formula go? Do I add a text box and
use properties and
event procedure... I don't understand. I'll try it in a
text box and see.

:

Not sure if I'll get the fields correct, but I think
you want to use DSum:
DSum("[CLUsEarned]","MyTable","[Employee] = " &
Me.txtEmployee & " AND
[Completion Date] > #" & DateAdd("yyyy",-2, Date()) &
"#")

HTH,
Barry

:

I have a database to track employee required
training. One form has 4 fields:
course, completion date, CLUs Earned, CLUs in past 24
months. I want to have
a text box or (not sure) field that will calculate
how many CLUs have been
earned in total during the past 24 months only. So,
when I open my
switchboard, the main form Employees, will display
how many CLUs this
employee has in the past 24 months. I also would like
to comment that these
community webpages have been so much help to me in
the last year as I built 4
databases. All the helpers are great!! Thank you
ahead of time for any and
all help.
 
I can't believe it... I've never had this much trouble seeing my mistake!!!
It just is not working.. still coming up with #Name?
Do I need to have a field in a table in order to add this control in the
form? I'm just adding a text box to the form and pasting the strand in
control source.

Barry Gilbert said:
Let this be a lesson to all of you
space-within-table-name-or-field-name-putting developers out there! Good
catch.

Douglas J. Steele said:
Actually, square brackets are required around the table name, because of the
spaces in its name:

=DSum("[CLUs Earned]","[Mandatory Continued Learning Units]","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" & DateAdd("yyyy",-2,Date()) &
"#")


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Barry Gilbert said:
Ok. Let's simplify it a bit by taking out the format statement:

=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" & DateAdd("yyyy",-2,Date()) &
"#")

Barry

:

Yes, it is a text field... I have an input mask though.. for a SSN.
Jan

:

Jan,

Please confirm that the SSN field in your table is a text field.
Barry

:

I'm still getting #Name? Here it is:
=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] =
'" &
Me.txtSSN & "' AND [Completion Date] > #" &
Format(DateAdd("yyyy",-2,Date()),"\#mm\/dd\/yyyy\#"))
What is wrong now?
Jan

:

If you plan to use Doug's suggestion, you left off the Format
function:

=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] =
'" &
Me.txtSSN & "' AND [Completion Date] > #" &
Format(DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#"))

Barry

:

Barry, I'm a mess... =( Here is how I have it now.. however,
you said to
preceed it with an equal sign but when I do it tells me I have
too many
arguments:
DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN]
= '" &
Me.txtSSN & "'AND [Completion Date] > #" &
DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#")
FYI: CLUs Earned is the name of a field in the Mandatory
Continued Learning
Units Table, SSN is what I use to relate all the tables so I can
track all
information in various forms and completion date is the name of
another field
in Mandatory Cont... Units Table. Still returning #Name? What
do you think
now?


:

Is this exactly what you put in your ControlSource? If so, you
need to
replace the field names, controls, and table name with the ones
in your db.
Also, my example assumes that your employee field is numeric.
If it's text,
change it like so:

","[Employee] = '" & Me.txtEmployee & "' AND ...
(notice the extra single quotes?)

Barry

:

Shoot Barry... I did it, here it is pasted in case I've done
something stupid:
=DSum("[CLUsEarned]","MyTable","[Employee] = " &
Me.txtEmployee & "AND
[Completion Date] > #" & DateAdd("yyyy",-2,Date()) & "#")

When I go to form view to take a look, the text box reads
#Name? Any ideas?

:

Put it in the ControlSource property of a textbox, preceded
by "=".

Barry

:

But where does this formula go? Do I add a text box and
use properties and
event procedure... I don't understand. I'll try it in a
text box and see.

:

Not sure if I'll get the fields correct, but I think
you want to use DSum:
DSum("[CLUsEarned]","MyTable","[Employee] = " &
Me.txtEmployee & " AND
[Completion Date] > #" & DateAdd("yyyy",-2, Date()) &
"#")

HTH,
Barry

:

I have a database to track employee required
training. One form has 4 fields:
course, completion date, CLUs Earned, CLUs in past 24
months. I want to have
a text box or (not sure) field that will calculate
how many CLUs have been
earned in total during the past 24 months only. So,
when I open my
switchboard, the main form Employees, will display
how many CLUs this
employee has in the past 24 months. I also would like
to comment that these
community webpages have been so much help to me in
the last year as I built 4
databases. All the helpers are great!! Thank you
ahead of time for any and
all help.
 
Jan,
Let's make sure the field types are correct.
CLUs Earned = numeric
SSN = Text
Completion Date = Date

Also, double-check the spelling of everything.

Barry

Jan said:
I can't believe it... I've never had this much trouble seeing my mistake!!!
It just is not working.. still coming up with #Name?
Do I need to have a field in a table in order to add this control in the
form? I'm just adding a text box to the form and pasting the strand in
control source.

Barry Gilbert said:
Let this be a lesson to all of you
space-within-table-name-or-field-name-putting developers out there! Good
catch.

Douglas J. Steele said:
Actually, square brackets are required around the table name, because of the
spaces in its name:

=DSum("[CLUs Earned]","[Mandatory Continued Learning Units]","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" & DateAdd("yyyy",-2,Date()) &
"#")


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Ok. Let's simplify it a bit by taking out the format statement:

=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" & DateAdd("yyyy",-2,Date()) &
"#")

Barry

:

Yes, it is a text field... I have an input mask though.. for a SSN.
Jan

:

Jan,

Please confirm that the SSN field in your table is a text field.
Barry

:

I'm still getting #Name? Here it is:
=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] =
'" &
Me.txtSSN & "' AND [Completion Date] > #" &
Format(DateAdd("yyyy",-2,Date()),"\#mm\/dd\/yyyy\#"))
What is wrong now?
Jan

:

If you plan to use Doug's suggestion, you left off the Format
function:

=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] =
'" &
Me.txtSSN & "' AND [Completion Date] > #" &
Format(DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#"))

Barry

:

Barry, I'm a mess... =( Here is how I have it now.. however,
you said to
preceed it with an equal sign but when I do it tells me I have
too many
arguments:
DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN]
= '" &
Me.txtSSN & "'AND [Completion Date] > #" &
DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#")
FYI: CLUs Earned is the name of a field in the Mandatory
Continued Learning
Units Table, SSN is what I use to relate all the tables so I can
track all
information in various forms and completion date is the name of
another field
in Mandatory Cont... Units Table. Still returning #Name? What
do you think
now?


:

Is this exactly what you put in your ControlSource? If so, you
need to
replace the field names, controls, and table name with the ones
in your db.
Also, my example assumes that your employee field is numeric.
If it's text,
change it like so:

","[Employee] = '" & Me.txtEmployee & "' AND ...
(notice the extra single quotes?)

Barry

:

Shoot Barry... I did it, here it is pasted in case I've done
something stupid:
=DSum("[CLUsEarned]","MyTable","[Employee] = " &
Me.txtEmployee & "AND
[Completion Date] > #" & DateAdd("yyyy",-2,Date()) & "#")

When I go to form view to take a look, the text box reads
#Name? Any ideas?

:

Put it in the ControlSource property of a textbox, preceded
by "=".

Barry

:

But where does this formula go? Do I add a text box and
use properties and
event procedure... I don't understand. I'll try it in a
text box and see.

:

Not sure if I'll get the fields correct, but I think
you want to use DSum:
DSum("[CLUsEarned]","MyTable","[Employee] = " &
Me.txtEmployee & " AND
[Completion Date] > #" & DateAdd("yyyy",-2, Date()) &
"#")

HTH,
Barry

:

I have a database to track employee required
training. One form has 4 fields:
course, completion date, CLUs Earned, CLUs in past 24
months. I want to have
a text box or (not sure) field that will calculate
how many CLUs have been
earned in total during the past 24 months only. So,
when I open my
switchboard, the main form Employees, will display
how many CLUs this
employee has in the past 24 months. I also would like
to comment that these
community webpages have been so much help to me in
the last year as I built 4
databases. All the helpers are great!! Thank you
ahead of time for any and
all help.
 
I actually have CLUs as text... spelling is correct.

Barry Gilbert said:
Jan,
Let's make sure the field types are correct.
CLUs Earned = numeric
SSN = Text
Completion Date = Date

Also, double-check the spelling of everything.

Barry

Jan said:
I can't believe it... I've never had this much trouble seeing my mistake!!!
It just is not working.. still coming up with #Name?
Do I need to have a field in a table in order to add this control in the
form? I'm just adding a text box to the form and pasting the strand in
control source.

Barry Gilbert said:
Let this be a lesson to all of you
space-within-table-name-or-field-name-putting developers out there! Good
catch.

:

Actually, square brackets are required around the table name, because of the
spaces in its name:

=DSum("[CLUs Earned]","[Mandatory Continued Learning Units]","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" & DateAdd("yyyy",-2,Date()) &
"#")


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Ok. Let's simplify it a bit by taking out the format statement:

=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] = '" &
Me.txtSSN & "' AND [Completion Date] > #" & DateAdd("yyyy",-2,Date()) &
"#")

Barry

:

Yes, it is a text field... I have an input mask though.. for a SSN.
Jan

:

Jan,

Please confirm that the SSN field in your table is a text field.
Barry

:

I'm still getting #Name? Here it is:
=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] =
'" &
Me.txtSSN & "' AND [Completion Date] > #" &
Format(DateAdd("yyyy",-2,Date()),"\#mm\/dd\/yyyy\#"))
What is wrong now?
Jan

:

If you plan to use Doug's suggestion, you left off the Format
function:

=DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN] =
'" &
Me.txtSSN & "' AND [Completion Date] > #" &
Format(DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#"))

Barry

:

Barry, I'm a mess... =( Here is how I have it now.. however,
you said to
preceed it with an equal sign but when I do it tells me I have
too many
arguments:
DSum("[CLUs Earned]","Mandatory Continued Learning Units","[SSN]
= '" &
Me.txtSSN & "'AND [Completion Date] > #" &
DateAdd("yyyy",-2,Date()),
"\#mm\/dd\/yyyy\#")
FYI: CLUs Earned is the name of a field in the Mandatory
Continued Learning
Units Table, SSN is what I use to relate all the tables so I can
track all
information in various forms and completion date is the name of
another field
in Mandatory Cont... Units Table. Still returning #Name? What
do you think
now?


:

Is this exactly what you put in your ControlSource? If so, you
need to
replace the field names, controls, and table name with the ones
in your db.
Also, my example assumes that your employee field is numeric.
If it's text,
change it like so:

","[Employee] = '" & Me.txtEmployee & "' AND ...
(notice the extra single quotes?)

Barry

:

Shoot Barry... I did it, here it is pasted in case I've done
something stupid:
=DSum("[CLUsEarned]","MyTable","[Employee] = " &
Me.txtEmployee & "AND
[Completion Date] > #" & DateAdd("yyyy",-2,Date()) & "#")

When I go to form view to take a look, the text box reads
#Name? Any ideas?

:

Put it in the ControlSource property of a textbox, preceded
by "=".

Barry

:

But where does this formula go? Do I add a text box and
use properties and
event procedure... I don't understand. I'll try it in a
text box and see.

:

Not sure if I'll get the fields correct, but I think
you want to use DSum:
DSum("[CLUsEarned]","MyTable","[Employee] = " &
Me.txtEmployee & " AND
[Completion Date] > #" & DateAdd("yyyy",-2, Date()) &
"#")

HTH,
Barry

:

I have a database to track employee required
training. One form has 4 fields:
course, completion date, CLUs Earned, CLUs in past 24
months. I want to have
a text box or (not sure) field that will calculate
how many CLUs have been
earned in total during the past 24 months only. So,
when I open my
switchboard, the main form Employees, will display
how many CLUs this
employee has in the past 24 months. I also would like
to comment that these
community webpages have been so much help to me in
the last year as I built 4
databases. All the helpers are great!! Thank you
ahead of time for any and
all help.
 
Back
Top