Replies in-line.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Michael Bulatovich" <Please@dont.try> wrote in message
news:HauEb.19171$CK3.1819779@news20.bellglobal.com ...[color=blue]
> Thanks for your response Allen. I'm an architect with no DB training so[/color]
I'm[color=blue]
> not sure what "data normalization" means. After thinking about it for a
> second or two, I think you mean that there is a way that the three fields
> could be made to not have the relationship of C=B-A, say when the form[/color]
isn't[color=blue]
> open, and that this could create a problem....
> I currently have some queries that go after the "hours" field directly.[/color]
What[color=blue]
> I think you are saying is that a query is a place to do the 'end time[/color]
minus[color=blue]
> start time" work, not the table. I appreciate the advice.[/color]
Yes. The calcuation is done in the query, whenever you need it.
If it seems better to you to store the duration in minutes (as a Number
field) rather than the EndTime (as a date/time field), that's fine.
[color=blue]
> As for the current time entry issue, what you suggest would enter the time
> that the new record was made. Could it be done with a button, where you[/color]
hit[color=blue]
> the button and the current time is entered into a target field in the
> record?[/color]
Yes: that line of code would go into the Event Procedure of for the Click
event of the command button.
[color=blue]
> On the rounding issue, I don't know where/how the line "15 *[/color]
Round([Minutes][color=blue]
> / 15, 0)" would be used.[/color]
That's up to you. It could be used in the query calculation, or it could be
used when storing the entry.
[color=blue]
>
> "Allen Browne" <AllenBrowne@SeeSig.Invalid> wrote in message
> news:3fe267ab$0$1730$5a62ac22@freenews.iinet.net.a u...[color=green]
> > For basic info on how to calculate the difference between two date/time
> > fields, see:
> > Calculating elapsed time
> > at:
> >
http://allenbrowne.com/casu-13.html
> >
> > For rounding to the nearest 15 minutes, use:
> > 15 * Round([Minutes] / 15, 0)
> >
> > In your table, store the starting time and EITHER the ending time OR the
> > duration. Storing both violates a basic rule of data normalization. The
> > other one can be calculated in a query, as explained in the article[/color][/color]
above.[color=blue][color=green]
> >
> > To pop the current time into a text box named "StartTime":
> > Me.[StartTime] = TimeValue(Now())
> > Omit the TimeValue() if you want the date as well.
> >
> > --
> > Allen Browne - Microsoft MVP. Perth, Western Australia.
> > Tips for Access users -
http://allenbrowne.com/tips.html
> > Reply to group, rather than allenbrowne at mvps dot org.
> >
> > "Michael Bulatovich" <Please@dont.try> wrote in message
> > news:nftEb.19037$CK3.1789753@news20.bellglobal.com ...[color=darkred]
> > > I have a very simple db I use for keeping track of hours, tasks,[/color][/color]
> projects,[color=green][color=darkred]
> > > clients etc. It has a form that I use to enter data. Currently the[/color][/color][/color]
form[color=blue][color=green]
> > has[color=darkred]
> > > a textbox for a field called "start time", another for a field called[/color][/color]
> "end[color=green][color=darkred]
> > > time" and a third for a field called "hours", among other controls. I[/color][/color]
> now[color=green][color=darkred]
> > > type in the approximate times in the first two textboxes, and mentally
> > > calculate and enter the difference or elapsed time in the third.
> > >
> > > I have tried to automate the completion of this third field with no[/color][/color]
> luck.[color=green]
> > I[color=darkred]
> > > have tried entering an expression in the control source field of the[/color][/color]
> text[color=green][color=darkred]
> > > box. I have tried stuff like "=[end time]-[start time]" and "=([end
> > > time]-[start time]*24)" but I'm clearly lost. The first two textboxes[/color][/color]
> are[color=green][color=darkred]
> > > formatted for "short time". "hours" is formatted as a "general[/color][/color][/color]
number".[color=blue][color=green][color=darkred]
> > >
> > > I would like to have the completion of the first two textboxes yield[/color][/color]
> their[color=green][color=darkred]
> > > difference in the "hours" field in the underlying table, and display[/color][/color][/color]
in[color=blue][color=green]
> > the[color=darkred]
> > > form textbox associated with this field. Some other considerations[/color][/color][/color]
are:[color=blue][color=green][color=darkred]
> > >
> > > Spanning midnight shouldn't be a problem.
> > >
> > > I would like to round the hours to the nearest quarter, since I'm
> > > approximating the time anyway.
> > >
> > > I would appreciate any help anyone could extend. One more thing: is[/color]
> > possible[color=darkred]
> > > to get a control (button) to record the current time in a field?[/color][/color][/color]