By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,471 Members | 2,277 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,471 IT Pros & Developers. It's quick & easy.

How to enter blocks of data

P: 64
Good afternoon.

I think I could think my way through this and waste days trying to figure it out but why not use this resource.

In access 2007 I have a time mangement database that basically is a timecard/data program. The techs all log there individual times through the program and it works fine. However, many of the admin types don't need to use work orders, ata codes, work codes etc, Just need to enter their time which is basically the same entry everyday.

Is there a method to enter blocks of time based on a date range where a user could enter a date range and the number of hours that should be posted to each date (assuming the number of hours is the same for each day)...and create an event that post the apprpriate time to each date within the date range? Therefore, using the program only once a week to enter his daily time for the week or date range.

I hope this is clear.

Thanks

Tomb
Aug 6 '08 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 112
Hopefully I understood you correctly, the following code will do what you want, it assumes the coulumn names listed (Date and HoursWorked) and that the table is named HoursWorked_tbl. I am sure there are other fields you would want to add such as employee number etc. But I think this logic will get you there. Let me know if you have questions or if I misunderstood what you were asking. Also when passing arguments to this make sure to explicitly convert to date or wrap it in the hash (#) characters, otherwise something like 5/8/2008 will be interpreted as 5 divided by 8 divided by 2008 and then converted to a date, which is probably not what you want.

Expand|Select|Wrap|Line Numbers
  1. Sub EnterDateBlock(DateStart As Date, DateEnd As Date, HoursPerDay As Double)
  2.     Dim intCounter As Integer
  3.     For intCounter = 0 To cint(DateEnd - DateStart)
  4.         DoCmd.RunSQL "INSERT INTO HoursWorked_tbl ([Date], HoursWorked) SELECT #" & DateEnd - intCounter & "#, " & HoursPerDay & ";"
  5.     Next intCounter
  6. End Sub
  7.  
Aug 6 '08 #2

P: 64
you guys are so good.


Thanks much...........

Tomb
Aug 7 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.