Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate remaining hours

Status
Not open for further replies.

Bob500

Technical User
Aug 8, 2003
65
EU
Hi,

I have a field on a table that holds a figure of 40 hours. This field is represented by a textbox on a form I want to be able to input a value of rounded to the nearest half an hour into a text box on a form and then the new number of hours to be displayed within the original textbox. Any ideas on the code to do this?
 
Hi

in the table, the field is presumably just a plain number field (eg integer, or long,... etc), not a date/time type - yes?

if so it is just a number, as long as you do not need to see hours and minutes, you just treat it as a number, it does not matter that it is hours, apples or what

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Hi, I figured this out:

Time being the field on the table that holds the remaining hours and text269 is a textbox to allow the input of time spent. The code is put on the after update event of 'text'

time = time - Text269

however, I am not sure how to round up the input to the nearest half an hour?

Thx
 
Hi

Which version of Access?

have you looked at Fix(), Round(), Int() and Format() functions ?

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
97, I will look at those.

Also on a tangent here but how could I build an 'excel' style spreadsheet from my database? Is it best to run a query and just put in all the fields?

Thx
 
Hi

If you mean make a view of the data that looks like a spread sheet, then yes either a query, or (better) a datasheet view form will do that

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top