RE: Increase time by set number of minutes
- From: Paolo <Paolo@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 18 Jun 2008 03:14:01 -0700
Hi S,
If I understood well your problem that should solve it:
let's say you have a form where you have 3 text box, one for the category
you wanna update called txt_category, one for the start time called
txt_start_time, and the third called num_min where you specify the number of
minutes between entries.
I call the table you wanna update yourtable where I assume there's a field
called for example category, another called entry and a third called start
containing the start time
Add to the form a button with this code
set rec=currentdb,openrecordset("select * from yourtable where category="""
& txt_category & """ order by entry",dbopendynaset)
num_entry=0
do while not rec.eof
rec.edit
rec!start=DateAdd("n", num_entry*num_min, txt_start_time)
rec.update
rec.movenext
num_entry=num_entry+1
loop
rec.close
msgbox "Update completed"
All this is aircode so you have to test it.
HTH Paolo
"S" wrote:
PLEASE IF ANYONE CAN HELP. I AM UNDER A DEADLINE..
THANK YOU!
"S" wrote:
I should mention - all entries are already entered into the database. I then
group them together by catagory and then manually assign it a catagory
number, an awards ceremony, and then an entry number.
I am not looking for it to automatically input the time when adding a new
record but instead fill in the time of entries already in the database when I
set a start time for each catagory or ceremony.
"TC Blue Boy" wrote:
Assume that you have a table with the time field defined as follows:
Field Name Data Type
EntryTime Date/Time - With Format of "Medium Time"
Also the Form has the EntryTime field on it but not updateable by the user.
Then create a "BeforeUpdate" event like so:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim datLastTime As Date
If Form.NewRecord Then
If DCount("EntryTime", "Table1") > 0 Then
datLastTime = DMax("EntryTime", "Table1")
EntryTime = DateAdd("n", 4, datLastTime)
End If
End If
End Sub
This should do it.
==============================
"S" wrote:
I have created a database for running a competition.
I am now trying to automate making a schedule.
I am looking for access to input the time for each record for me to create a
schedule.
Say entry # 001 starts at 8:00AM and each entry is 4 minutes long.
how do i get access to automatically go to entry 002 and fill in the time as
8:04AM
entry 003 as 8:08AM etc etc.
- Follow-Ups:
- References:
- Prev by Date: Re: Programatically amend an ODBC Connection
- Next by Date: Re: Combining codes
- Previous by thread: RE: Increase time by set number of minutes
- Next by thread: RE: Increase time by set number of minutes
- Index(es):