473,385 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Auto Population of Fields

Currently I have four datetime fields:

DteTimeNotified
DteTimeStarted
DteTimeCompleted
DteTimeReported

Each of these fields contain the input mask 99/99/00" "00:00;0

This gives me a short date and military time.

In order to save data entry time I would like to have each of these
fields populated whenever the entry of DteTimeNotified is complete.

ie The last three fields will be populated with the previous datetime
plus ten minutes. The cursor would need only have to go to the hours
and minutes 00:00 area of the mask for update because normally it
takes about a half hour to an hour to complete the cycle.

Any help would be greatly appreciated.

Kenny G
Nov 12 '05 #1
2 1978
Dont know if this is any help.
It was used to input race finishing times where the previous time was the
base line and if you keyed in a 1 or 2 digit number it assumed the base time
+ the number of seconds keyed in. If you keyed in a 4 digit number int
interpreted it as minutes and seconds. Might be the basis of your code.
Sorry about the race crap in it

Phil
Private Sub EnterTime_AfterUpdate()

Dim TimeStg As String
Dim Time As Date
Dim Secs As Integer, Mins As Integer, Hours As Integer
Dim NewSecs As Integer, NewMins As Integer

If Nz(EnterTime) = 0 Then
DoCmd.GoToControl "RaceFinishTime"
End If

If Nz(LastTime) = 0 Then
DoCmd.GoToControl "RaceFinishTime"
Exit Sub
End If

TimeStg = CStr(LastTime)
If Not IsNumeric(EnterTime) Then
DoCmd.GoToControl "RaceFinishTime"
Exit Sub
End If

Seconds:
Secs = Right$(LastTime, 2)
Mins = Mid$(LastTime, 4, 2)
Hours = Left(LastTime, 2)

If Len(EnterTime) <> 2 Then ' 2 figures for seconds
GoTo SecsWithPoint
End If

If EnterTime < 0 Or EnterTime > 59 Then
MsgBox "There are 60 seconds in a minute", vbCritical
Exit Sub
End If

If EnterTime < Right$(TimeStg, 2) Then ' next minute
Mins = Mins + 1
If Mins > 59 Then
Hours = Hours + 1
Mins = 0
End If
End If

TimeStg = Hours & ":" & Mins & ":" & EnterTime
GoTo Update
SecsWithPoint:
If Len(EnterTime) <> 3 Then
GoTo Minutes
End If

If Left$(EnterTime, 1) = "." Or Left$(EnterTime, 1) = ":" Then
EnterTime = Right$(EnterTime, 2)
GoTo Seconds
End If

Minutes:

If Len(EnterTime) <> 4 Then ' Not minutes
DoCmd.GoToControl "RaceFinishTime"
End If

NewSecs = Right$(EnterTime, 2)
NewMins = Left$(EnterTime, 2)

If NewSecs < 0 Or NewSecs > 59 Then
MsgBox "There are 60 seconds in a minute", vbCritical
Exit Sub
End If
If NewMins < 0 Or NewMins > 59 Then
MsgBox "There are 60 minutes in an hour ", vbCritical
Exit Sub
End If

TimeStg = Hours & ":" & NewMins & ":" & NewSecs
Update:

Time = CDate(TimeStg)
RaceFinishTime = Time
LastTime = Time

If IsNull(RaceFinishTime) Then
RaceFinishDate = Null
Exit Sub
End If

LastTime = RaceFinishTime

If IsNull(RaceFinishDate) Then
If RaceFinishTime < GetStartDate(DivisionID, 2) Then ' At least
next day
RaceFinishDate = DateAdd("d", 1, GetStartDate(DivisionID, 2)) '
Next day
Else
RaceFinishDate = GetStartDate(DivisionID, 1) '
same day
End If
End If

CorrectedTime.Requery

End Sub

Private Sub EnterTime_BeforeUpdate(Cancel As Integer)

Dim Msg As String
Dim StartDate As Date, StartTime As Date

StartTime = GetStartDate(DivisionID, 2) ' Time
If StartTime = 0 Then ' Invalid
Msg = "There is no start time set for: " & Division
MsgBox Msg, vbCritical
DoCmd.CancelEvent
Exit Sub
End If

StartDate = GetStartDate(DivisionID, 1) ' date
If StartDate = 0 Then ' Invalid
Msg = "There is no start date set for: " & Division
MsgBox Msg, vbCritical
DoCmd.CancelEvent
Exit Sub
End If

If AtStartLine = True And RaceFinishTime >= StartTime And RaceFinishDate
= StartDate Then Exit Sub
End If
If AtStartLine = False Then
Msg = "This boat has not come to the Start Line" & Chr$(13)
Msg = Msg & "Is this boat a starter?"
If MsgBox(Msg, vbInformation + vbYesNo) = vbYes Then
AtStartLine = True
Else
DoCmd.CancelEvent
Exit Sub
End If
End If
If RaceFinishTime < StartDate And RaceFinishDate <= StartTime Then
MsgBox "This boat has finished before she has started",
vbInformation
DoCmd.CancelEvent
Exit Sub
End If
If RaceFinishDate < StartDate Then
MsgBox "This boat has finished on a day before she has started",
vbInformation
DoCmd.CancelEvent
Exit Sub
End If

End Sub
"Kenny G" <kg****@hotmail.com> wrote in message
news:81**************************@posting.google.c om... Currently I have four datetime fields:

DteTimeNotified
DteTimeStarted
DteTimeCompleted
DteTimeReported

Each of these fields contain the input mask 99/99/00" "00:00;0

This gives me a short date and military time.

In order to save data entry time I would like to have each of these
fields populated whenever the entry of DteTimeNotified is complete.

ie The last three fields will be populated with the previous datetime
plus ten minutes. The cursor would need only have to go to the hours
and minutes 00:00 area of the mask for update because normally it
takes about a half hour to an hour to complete the cycle.

Any help would be greatly appreciated.

Kenny G

Nov 12 '05 #2
Thanks for your input. I'll try it today.

Kenny G

"Phil Stanton" <ph**@stantonfamily.co.uk> wrote in message news:<3f*********************@mercury.nildram.net> ...
Dont know if this is any help.
It was used to input race finishing times where the previous time was the
base line and if you keyed in a 1 or 2 digit number it assumed the base time
+ the number of seconds keyed in. If you keyed in a 4 digit number int
interpreted it as minutes and seconds. Might be the basis of your code.
Sorry about the race crap in it

Phil
Private Sub EnterTime_AfterUpdate()

Dim TimeStg As String
Dim Time As Date
Dim Secs As Integer, Mins As Integer, Hours As Integer
Dim NewSecs As Integer, NewMins As Integer

If Nz(EnterTime) = 0 Then
DoCmd.GoToControl "RaceFinishTime"
End If

If Nz(LastTime) = 0 Then
DoCmd.GoToControl "RaceFinishTime"
Exit Sub
End If

TimeStg = CStr(LastTime)
If Not IsNumeric(EnterTime) Then
DoCmd.GoToControl "RaceFinishTime"
Exit Sub
End If

Seconds:
Secs = Right$(LastTime, 2)
Mins = Mid$(LastTime, 4, 2)
Hours = Left(LastTime, 2)

If Len(EnterTime) <> 2 Then ' 2 figures for seconds
GoTo SecsWithPoint
End If

If EnterTime < 0 Or EnterTime > 59 Then
MsgBox "There are 60 seconds in a minute", vbCritical
Exit Sub
End If

If EnterTime < Right$(TimeStg, 2) Then ' next minute
Mins = Mins + 1
If Mins > 59 Then
Hours = Hours + 1
Mins = 0
End If
End If

TimeStg = Hours & ":" & Mins & ":" & EnterTime
GoTo Update
SecsWithPoint:
If Len(EnterTime) <> 3 Then
GoTo Minutes
End If

If Left$(EnterTime, 1) = "." Or Left$(EnterTime, 1) = ":" Then
EnterTime = Right$(EnterTime, 2)
GoTo Seconds
End If

Minutes:

If Len(EnterTime) <> 4 Then ' Not minutes
DoCmd.GoToControl "RaceFinishTime"
End If

NewSecs = Right$(EnterTime, 2)
NewMins = Left$(EnterTime, 2)

If NewSecs < 0 Or NewSecs > 59 Then
MsgBox "There are 60 seconds in a minute", vbCritical
Exit Sub
End If
If NewMins < 0 Or NewMins > 59 Then
MsgBox "There are 60 minutes in an hour ", vbCritical
Exit Sub
End If

TimeStg = Hours & ":" & NewMins & ":" & NewSecs
Update:

Time = CDate(TimeStg)
RaceFinishTime = Time
LastTime = Time

If IsNull(RaceFinishTime) Then
RaceFinishDate = Null
Exit Sub
End If

LastTime = RaceFinishTime

If IsNull(RaceFinishDate) Then
If RaceFinishTime < GetStartDate(DivisionID, 2) Then ' At least
next day
RaceFinishDate = DateAdd("d", 1, GetStartDate(DivisionID, 2)) '
Next day
Else
RaceFinishDate = GetStartDate(DivisionID, 1) '
same day
End If
End If

CorrectedTime.Requery

End Sub

Private Sub EnterTime_BeforeUpdate(Cancel As Integer)

Dim Msg As String
Dim StartDate As Date, StartTime As Date

StartTime = GetStartDate(DivisionID, 2) ' Time
If StartTime = 0 Then ' Invalid
Msg = "There is no start time set for: " & Division
MsgBox Msg, vbCritical
DoCmd.CancelEvent
Exit Sub
End If

StartDate = GetStartDate(DivisionID, 1) ' date
If StartDate = 0 Then ' Invalid
Msg = "There is no start date set for: " & Division
MsgBox Msg, vbCritical
DoCmd.CancelEvent
Exit Sub
End If

If AtStartLine = True And RaceFinishTime >= StartTime And RaceFinishDate
= StartDate Then

Exit Sub
End If
If AtStartLine = False Then
Msg = "This boat has not come to the Start Line" & Chr$(13)
Msg = Msg & "Is this boat a starter?"
If MsgBox(Msg, vbInformation + vbYesNo) = vbYes Then
AtStartLine = True
Else
DoCmd.CancelEvent
Exit Sub
End If
End If
If RaceFinishTime < StartDate And RaceFinishDate <= StartTime Then
MsgBox "This boat has finished before she has started",
vbInformation
DoCmd.CancelEvent
Exit Sub
End If
If RaceFinishDate < StartDate Then
MsgBox "This boat has finished on a day before she has started",
vbInformation
DoCmd.CancelEvent
Exit Sub
End If

End Sub
"Kenny G" <kg****@hotmail.com> wrote in message
news:81**************************@posting.google.c om...
Currently I have four datetime fields:

DteTimeNotified
DteTimeStarted
DteTimeCompleted
DteTimeReported

Each of these fields contain the input mask 99/99/00" "00:00;0

This gives me a short date and military time.

In order to save data entry time I would like to have each of these
fields populated whenever the entry of DteTimeNotified is complete.

ie The last three fields will be populated with the previous datetime
plus ten minutes. The cursor would need only have to go to the hours
and minutes 00:00 area of the mask for update because normally it
takes about a half hour to an hour to complete the cycle.

Any help would be greatly appreciated.

Kenny G

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David Shorthouse | last post by:
HI is it posible to auto populate an access database.? I have 1 table structured Index_ID. - Index & auto number First_Name - Char50 Surname - Char50 Initals - Char50 Postcode - Char50...
46
by: Kingdom | last post by:
In my data base I have a list of componet types e.g. type A - I have 8 off - type B I have 12 off etc. I'm using Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM Parts_Table") ...
2
by: Tom | last post by:
I am trying to store information into a table that has an auto increment field. There is currently no data in the table. Using the code below I cannot insert data into the table. I get an error...
1
by: John Phelan-Cummings | last post by:
I'm not certain if this made the post. Sorry if it's a repeat: Using a Button to take an autonumber from one form to populate another autonumber field on another form. I have a Mainform "A"...
0
by: Brian Henry | last post by:
I'm sure some of you ran into this already and wondered how to fix it. When you Have a solution that contains solution folders (the partially transparent folders that can hold groupings of...
2
by: des-sd | last post by:
Access Experts, Please help! I have looked through ref. manuals, Google Groups on "Auto Populate", and I am still lost. Problem #1 My DB is 2 relational tables of (1) sales transactions of,...
14
by: neonman14 | last post by:
Hello I am in Intro to Java Programming and I am having problems with assignment. The Homework assignment is called Population. Population Write a program that will predict the size of a...
1
by: Clive Swan | last post by:
Hi I am trying to sum a population field that may have 140 records for each Ward (example). Any suggestions on the best way to do this. I would like to have a unique record for each Ward...
1
by: tg | last post by:
http://img522.imageshack.us/img522/8647/scan10005ci7.jpg As a percentage of world inhabitants, the white population will plummet to a single digit (9.76%) by 2060 from a high-water mark of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.