A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Time calculation



 
 
Thread Tools Display Modes
  #1  
Old September 18th, 2004, 04:32 PM
Paul
external usenet poster
 
Posts: n/a
Default Time calculation

Hi gang,

I've already been he

http://www.mvps.org/access/datetime/date0004.htm

I have 2 time fields, "Time In" and "Time Out". I have a
third field, a number field, that is to receive a
difference of the 2. Like I said, I tried the expression
from the link above and got this error:

"The database engine does not recognize either the
field "Time In" in a validation expression, or the
default value in the table "Task" "

I'm assuming the expression from the link is to go into
the Default Value section of the intemded field. Can
anyone please explain to me,like a 4-year old, what I did
incorrectly??

Thanks very much,
Paul
  #2  
Old September 18th, 2004, 05:21 PM
Rick Brandt
external usenet poster
 
Posts: n/a
Default

"Paul" wrote in message
...
Hi gang,

I've already been he

http://www.mvps.org/access/datetime/date0004.htm

I have 2 time fields, "Time In" and "Time Out". I have a
third field, a number field, that is to receive a
difference of the 2. Like I said, I tried the expression
from the link above and got this error:

"The database engine does not recognize either the
field "Time In" in a validation expression, or the
default value in the table "Task" "

I'm assuming the expression from the link is to go into
the Default Value section of the intemded field.


No, it goes in the ControlSource (assuming you're talking about a Form which
actually "controls", not "fields").


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


  #3  
Old September 19th, 2004, 01:35 AM
external usenet poster
 
Posts: n/a
Default

Actually, Rick, I was talking not about forms, as I
hadn't even progressed taht far I did kind of a rush
job on this, and am entering data right at the datasheet
level of the table itself. That's why I was hoping I
could utiize the Format fucntion of the expression
builder attached to the Default Value of the field itself
in the table.

Does all this mean that function won't work on that level?

Thanks again for your time.
Paul


-----Original Message-----
"Paul" wrote in message
...
Hi gang,

I've already been he

http://www.mvps.org/access/datetime/date0004.htm

I have 2 time fields, "Time In" and "Time Out". I

have a
third field, a number field, that is to receive a
difference of the 2. Like I said, I tried the

expression
from the link above and got this error:

"The database engine does not recognize either the
field "Time In" in a validation expression, or the
default value in the table "Task" "

I'm assuming the expression from the link is to go into
the Default Value section of the intemded field.


No, it goes in the ControlSource (assuming you're

talking about a Form which
actually "controls", not "fields").


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


.

  #4  
Old September 19th, 2004, 02:21 AM
John Vinson
external usenet poster
 
Posts: n/a
Default

On Sat, 18 Sep 2004 08:32:34 -0700, "Paul"
wrote:

Hi gang,

I've already been he

http://www.mvps.org/access/datetime/date0004.htm

I have 2 time fields, "Time In" and "Time Out". I have a
third field, a number field, that is to receive a
difference of the 2. Like I said, I tried the expression
from the link above and got this error:

"The database engine does not recognize either the
field "Time In" in a validation expression, or the
default value in the table "Task" "


Reread the explanation on the website.

You cannot and should not store this time difference in a Table - *at
all*.

Storing derived data such as this in your table accomplishes
three things: it wastes disk space; it wastes time (almost
any calculation will be MUCH faster than a disk fetch); and
most importantly, it risks data corruption. If one of the
underlying fields is subsequently edited, you will have data
in your table WHICH IS WRONG, and no automatic way to detect
that fact.

Just redo the calculation whenever you need it, either as a
calculated field in a Query or just as you're now doing it -
in the control source of a Form or a Report textbox.


John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
  #5  
Old September 19th, 2004, 01:27 PM
Jeff Boyce
external usenet poster
 
Posts: n/a
Default

Paul

To add to Rick's and John's suggestions, I would ask a clarifying question.
What data type are you using to hold the "time" values. I'm unaware of an
Access datatype for "time" only.

--
More info, please ...

Jeff Boyce
Access MVP

  #6  
Old September 19th, 2004, 11:13 PM
goofy
external usenet poster
 
Posts: n/a
Default

These answers seem very complicated.
Assuming you have TimeIn and TimeOut in TableName,
the following functions will readily generate
the difference:
NetWorkDays([TableName]![timeIn],[TableName]![timeOut]), if you like, or
DateDiff("s",[TableName]![time1],[TableName]![time2]) for seconds, "d" for
days, etc.

You definitely should NOT store this, as the number can readily be
calculated from
information in the table.

Scott

"Paul" wrote in message
...
Hi gang,

I've already been he

http://www.mvps.org/access/datetime/date0004.htm

I have 2 time fields, "Time In" and "Time Out". I have a
third field, a number field, that is to receive a
difference of the 2. Like I said, I tried the expression
from the link above and got this error:

"The database engine does not recognize either the
field "Time In" in a validation expression, or the
default value in the table "Task" "

I'm assuming the expression from the link is to go into
the Default Value section of the intemded field. Can
anyone please explain to me,like a 4-year old, what I did
incorrectly??

Thanks very much,
Paul



  #7  
Old September 19th, 2004, 11:54 PM
Douglas J. Steele
external usenet poster
 
Posts: n/a
Default

Um, there's no NetWorkDays function in Access, Scott.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"goofy" wrote in message
ink.net...
These answers seem very complicated.
Assuming you have TimeIn and TimeOut in TableName,
the following functions will readily generate
the difference:
NetWorkDays([TableName]![timeIn],[TableName]![timeOut]), if you like, or
DateDiff("s",[TableName]![time1],[TableName]![time2]) for seconds, "d"

for
days, etc.

You definitely should NOT store this, as the number can readily be
calculated from
information in the table.

Scott

"Paul" wrote in message
...
Hi gang,

I've already been he

http://www.mvps.org/access/datetime/date0004.htm

I have 2 time fields, "Time In" and "Time Out". I have a
third field, a number field, that is to receive a
difference of the 2. Like I said, I tried the expression
from the link above and got this error:

"The database engine does not recognize either the
field "Time In" in a validation expression, or the
default value in the table "Task" "

I'm assuming the expression from the link is to go into
the Default Value section of the intemded field. Can
anyone please explain to me,like a 4-year old, what I did
incorrectly??

Thanks very much,
Paul





  #8  
Old January 18th, 2005, 08:55 PM
pvdalen
external usenet poster
 
Posts: n/a
Default

Hey John,

Just wanted to let you know you convinced me. I removed the "Hours" field
in the database and now emply calculatons where I need them. I think I
balked initially at that solution, because I have separate date and time
fields, and it seemed like a pain in the ass, but simple concatenation worked
fine.

Thanks again, John. You're always a big help.

Paul

"John Vinson" wrote:

On Sat, 18 Sep 2004 08:32:34 -0700, "Paul"
wrote:

Hi gang,

I've already been he

http://www.mvps.org/access/datetime/date0004.htm

I have 2 time fields, "Time In" and "Time Out". I have a
third field, a number field, that is to receive a
difference of the 2. Like I said, I tried the expression
from the link above and got this error:

"The database engine does not recognize either the
field "Time In" in a validation expression, or the
default value in the table "Task" "


Reread the explanation on the website.

You cannot and should not store this time difference in a Table - *at
all*.

Storing derived data such as this in your table accomplishes
three things: it wastes disk space; it wastes time (almost
any calculation will be MUCH faster than a disk fetch); and
most importantly, it risks data corruption. If one of the
underlying fields is subsequently edited, you will have data
in your table WHICH IS WRONG, and no automatic way to detect
that fact.

Just redo the calculation whenever you need it, either as a
calculated field in a Query or just as you're now doing it -
in the control source of a Form or a Report textbox.


John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Elapsed Time Calculation? Ken General Discussion 1 September 15th, 2004 08:51 PM
time zone & apt times auto changing Mary Calendar 6 May 25th, 2004 05:44 AM
time calculation David McRitchie Setting up and Configuration 2 March 28th, 2004 09:14 PM


All times are GMT +1. The time now is 05:44 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.