Getting Number Of Days

J

jrp444

I set up form to find the number of days between Charge Date and Current
Date.The following is how I have it set up.(Both date fields are formated for
short dates):
Charge Date (inputted Date) Current Date ( Date()) and No Days
(=DateDiff("d",[Charge-Off Date],[Current Date]))

I am getting a NAME# in the No Days. Can anyone tell me what is the problem?

Thanks!
 
D

Duane Hookom

You should be able to set your control source to:
=DateDiff("d",[Charge-Off Date],[Current Date])
or

=DateDiff("d",[Charge-Off Date],Date())

Make sure the name of the control is not the name of a field.
 
J

jrp444

I am like you I thought it should work. It will work one time until I save
the form and then it gives me the error. Any ideas???????

Duane Hookom said:
You should be able to set your control source to:
=DateDiff("d",[Charge-Off Date],[Current Date])
or

=DateDiff("d",[Charge-Off Date],Date())

Make sure the name of the control is not the name of a field.

--
Duane Hookom
MS Access MVP

jrp444 said:
I set up form to find the number of days between Charge Date and Current
Date.The following is how I have it set up.(Both date fields are formated
for
short dates):
Charge Date (inputted Date) Current Date ( Date()) and No Days
(=DateDiff("d",[Charge-Off Date],[Current Date]))

I am getting a NAME# in the No Days. Can anyone tell me what is the
problem?

Thanks!
 
D

Duane Hookom

Does the expression work for some records but not others? Do you have date
values in all necessary fields?

--
Duane Hookom
MS Access MVP

jrp444 said:
I am like you I thought it should work. It will work one time until I save
the form and then it gives me the error. Any ideas???????

Duane Hookom said:
You should be able to set your control source to:
=DateDiff("d",[Charge-Off Date],[Current Date])
or

=DateDiff("d",[Charge-Off Date],Date())

Make sure the name of the control is not the name of a field.

--
Duane Hookom
MS Access MVP

jrp444 said:
I set up form to find the number of days between Charge Date and
Current
Date.The following is how I have it set up.(Both date fields are
formated
for
short dates):
Charge Date (inputted Date) Current Date ( Date()) and No Days
(=DateDiff("d",[Charge-Off Date],[Current Date]))

I am getting a NAME# in the No Days. Can anyone tell me what is the
problem?

Thanks!
 
J

jrp444

I found that if I took out the EXIT button it works. But with the EXIT
button in the form it gives me this error and will not exit but gives me an
error message. This made no sense to me.

Duane Hookom said:
Does the expression work for some records but not others? Do you have date
values in all necessary fields?

--
Duane Hookom
MS Access MVP

jrp444 said:
I am like you I thought it should work. It will work one time until I save
the form and then it gives me the error. Any ideas???????

Duane Hookom said:
You should be able to set your control source to:
=DateDiff("d",[Charge-Off Date],[Current Date])
or

=DateDiff("d",[Charge-Off Date],Date())

Make sure the name of the control is not the name of a field.

--
Duane Hookom
MS Access MVP

I set up form to find the number of days between Charge Date and
Current
Date.The following is how I have it set up.(Both date fields are
formated
for
short dates):
Charge Date (inputted Date) Current Date ( Date()) and No Days
(=DateDiff("d",[Charge-Off Date],[Current Date]))

I am getting a NAME# in the No Days. Can anyone tell me what is the
problem?

Thanks!
 
D

Duane Hookom

Sounds like either a corruption or references issue. Check
http://www.accessmvp.com/djsteele/AccessReferenceErrors.html.

--
Duane Hookom
MS Access MVP

jrp444 said:
I found that if I took out the EXIT button it works. But with the EXIT
button in the form it gives me this error and will not exit but gives me
an
error message. This made no sense to me.

Duane Hookom said:
Does the expression work for some records but not others? Do you have
date
values in all necessary fields?

--
Duane Hookom
MS Access MVP

jrp444 said:
I am like you I thought it should work. It will work one time until I
save
the form and then it gives me the error. Any ideas???????

:

You should be able to set your control source to:
=DateDiff("d",[Charge-Off Date],[Current Date])
or

=DateDiff("d",[Charge-Off Date],Date())

Make sure the name of the control is not the name of a field.

--
Duane Hookom
MS Access MVP

I set up form to find the number of days between Charge Date and
Current
Date.The following is how I have it set up.(Both date fields are
formated
for
short dates):
Charge Date (inputted Date) Current Date ( Date()) and No Days
(=DateDiff("d",[Charge-Off Date],[Current Date]))

I am getting a NAME# in the No Days. Can anyone tell me what is the
problem?

Thanks!
 
J

jrp444

I appreciate the help. The article was very useful.

Thanks!!!!!

Duane Hookom said:
Sounds like either a corruption or references issue. Check
http://www.accessmvp.com/djsteele/AccessReferenceErrors.html.

--
Duane Hookom
MS Access MVP

jrp444 said:
I found that if I took out the EXIT button it works. But with the EXIT
button in the form it gives me this error and will not exit but gives me
an
error message. This made no sense to me.

Duane Hookom said:
Does the expression work for some records but not others? Do you have
date
values in all necessary fields?

--
Duane Hookom
MS Access MVP

I am like you I thought it should work. It will work one time until I
save
the form and then it gives me the error. Any ideas???????

:

You should be able to set your control source to:
=DateDiff("d",[Charge-Off Date],[Current Date])
or

=DateDiff("d",[Charge-Off Date],Date())

Make sure the name of the control is not the name of a field.

--
Duane Hookom
MS Access MVP

I set up form to find the number of days between Charge Date and
Current
Date.The following is how I have it set up.(Both date fields are
formated
for
short dates):
Charge Date (inputted Date) Current Date ( Date()) and No Days
(=DateDiff("d",[Charge-Off Date],[Current Date]))

I am getting a NAME# in the No Days. Can anyone tell me what is the
problem?

Thanks!
 
Top