time calculations

M

michele CD

Hi
I am new to access and teaching myself...
I have created a database into which is put
2 fields: timein and timeout and a third: minutes.
They are all of the datatype time/date.
Now, I am going into forms and creating an event for minutes that wil
calculate the difference in the 2 times in minutes.(assuming no time i
greater than 24 hrs)
I have used:
DateDiff("n", [timein], [timeout])
-typing it into the minutes box in forms and then saving it-
but am not creating anything in the minutes filed when i test it.
although sometimes i get #Name?
I am certain that this is a remedial question but I have exausted
other resources...
I know C++, but not VB macros.

am i putting it in the wrong place?
any help is appreciated...I'd rather do this calculation in access tha
take it back to excel.
thanks alot
Michele C
 
M

MacDermott

Hi, Michele!

I'm concerned about your statement that you are "creating an event".
Normally a calculation like this would be done in the ControlSource property
of your [Minutes] textbox.
It would look like this:
=DateDiff("n", [timein], [timeout])
If your form is based on your table, and the controls on your form have the
same names as the fields, this should work.

Note, however, that this will not (and should not) enter any values into
your Minutes field in your underlying table.
In fact, you can/should remove that field and get that value from
calculations when you need it.
This is one of the fundamental differences between Access and Excel.

HTH
- Turtle
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top