Time Button (1 Viewer)

.Justin

Registered User.
Local time
Today, 12:28
Joined
Jun 29, 2009
Messages
38
Hi All,

I am making a system for A Level coursework for a real end user client. The system logs incidents for a private medical company when they cover medical events. They need to input different times for where the vehicle or unit is at different statuses during an incident. Is there a way where my user and put the cursor in the field they want to enter the time into and click a button and the system will input the current time.

If so would anyone be able provide me with a step by step way or a code etc?

Thank you!

 

Attachments

  • Incident_Table.png
    Incident_Table.png
    58.2 KB · Views: 72

Fuga

Registered User.
Local time
Today, 13:28
Joined
Feb 28, 2002
Messages
566
Hi,

Can´t you just have now() as the default value of the field?

Fuga.
 

.Justin

Registered User.
Local time
Today, 12:28
Joined
Jun 29, 2009
Messages
38
Nope because they are updated at different times. A unit may be mobile at 09:54 and may not be clear unit 10:34
 

vbaInet

AWF VIP
Local time
Today, 12:28
Joined
Jan 22, 2010
Messages
26,374
On the Click event of the button put this:

Me.NameOfTextbox.Value = Time()

Set the Format property of the textbox to something like Medium Time.
 

Mr Smin

Sometimes Excel too.
Local time
Today, 11:28
Joined
Jun 1, 2009
Messages
132
Create button called something like btnTimeNow and in it's onClick event putcode that says [TimeOnScene]=Now()
(where TimeOnScene is the name of the field)

You will save the dispatcher a lot of bother by DateAlerted default to current date!

Also, keep a manual override option on those time fields - since you will need a button next to each of them for 'current time', it will be very easy to accidentally click the wrong one and need to correct that.

You should also (sorry to go on) have some code that warns the user if input makes no sense, such as on scene being later than left scene.

[disclaimer: I'm a qualified EMT so I'm interested in what comes down the line from the EOC :) ]
 

vbaInet

AWF VIP
Local time
Today, 12:28
Joined
Jan 22, 2010
Messages
26,374
Create button called something like btnTimeNow and in it's onClick event putcode that says [TimeOnScene]=Now()
(where TimeOnScene is the name of the field)
Pretty much covered in my post above. But you don't use Now() because that includes a date part, you use Time().
 

Fuga

Registered User.
Local time
Today, 13:28
Joined
Feb 28, 2002
Messages
566
Hi again,

Well you got some good help. I just wanted to mention that perhaps you´ll run into a problem later on if you don´t have your logging events in a separate table, so that you can add an unlimited number of entries for every unit.

Fuga.
 

smig

Registered User.
Local time
Today, 14:28
Joined
Nov 25, 2009
Messages
2,209
or format(now(), timeformat)
this way you can set any time format you want

my one cent tip:
you can use the doubleClick event of the time field instead of a button.
 

vbaInet

AWF VIP
Local time
Today, 12:28
Joined
Jan 22, 2010
Messages
26,374
Still shouldn't be using Now() as already mentioned twice. Time() is what the OP wants.
 

missinglinq

AWF VIP
Local time
Today, 07:28
Joined
Jun 20, 2003
Messages
6,423
...perhaps you´ll run into a problem later on if you don´t have your logging events in a separate table, so that you can add an unlimited number of entries for every unit.
I believe a given unit will only have one TimeOnScene entry, one TimeCleared Scene entry, etc, per incident, so having a separate table really wouldn't be appropriate in this scenario.

The event to trigger the time entry probably needs to be, as Smig suggested, the DoubleClick event, so that manual entry or entry correction can be made by 'single clicking' into the field.

Linq ;0)>
 

ChipperT

Banned in 13 Countries
Local time
Today, 04:28
Joined
Jun 1, 2010
Messages
347
I wouldn't do a DoubleClick as that is counter-intuitive for a user (buttons are normally single-click controls). Instead I would code the OnClick event with something like:
If tbTimeNow.Value.Length > 0 then
[TimeOnScene]=tbTimeNow.Value
Else
tbTimeNow.Value=Time()
[TimeOnScene]=tbTimeNow.Value
End If

That way, if the user had put a time value in the text box, that would be the value placed in the field. Otherwise, the current time as of the button click would be put there.
 

DCrake

Remembered
Local time
Today, 12:28
Joined
Jun 8, 2005
Messages
8,632
All this talk about what to use for recording the current time in a field seems to me to be somewhat over intuative. Lets say it is now 14:00 and you get the paper copy of the report and it has been recorded at 13:30 whatever method you employ the time is going to be wrong and you are going to have to edit it anyway to record the correct time.

If you record the time arrived at 12:15 are you going to sit there whle 13:20 to click the time departed?
 

missinglinq

AWF VIP
Local time
Today, 07:28
Joined
Jun 20, 2003
Messages
6,423
I wouldn't do a DoubleClick as that is counter-intuitive for a user (buttons are normally single-click controls)
Smig and I were both talking about using the DoubleClick event of the textbox being used to enter/display the time field, not a button! The OnClick event of the texbox has to be reserved so that the user can click into it to edit the time, if need be.

They need to input different times for where the vehicle or unit is at different statuses during an incident. Is there a way where my user and put the cursor in the field they want to enter the time into and click a button and the system will input the current time.
I assumed from the way that this was posted that the users were entering this data in real-time, at the incident scene, using a mobile device. Not sure about your side of The Pond, but this quite common now in the States.
 

ChipperT

Banned in 13 Countries
Local time
Today, 04:28
Joined
Jun 1, 2010
Messages
347
Smig and I were both talking about using the DoubleClick event of the textbox being used to enter/display the time field, not a button! The OnClick event of the texbox has to be reserved so that the user can click into it to edit the time, if need be.

But again a DoubleClick is counter-intuitive in a user interface IMHO.
 

missinglinq

AWF VIP
Local time
Today, 07:28
Joined
Jun 20, 2003
Messages
6,423
Not at all! Using it for things like this involving textboxes is frequently used by experienced developers.
 

Mr Smin

Sometimes Excel too.
Local time
Today, 11:28
Joined
Jun 1, 2009
Messages
132
I assumed from the way that this was posted that the users were entering this data in real-time, at the incident scene, using a mobile device. Not sure about your side of The Pond, but this quite common now in the States.

An in-vehicle terminal is standard for the govt. emergency services in general here, but the OP is programming for an independent company. Likely they are providing cover at special events and their activity level will only require a radio operator entering data onto this form at a control centre, on behalf of field staff.

As an aside, I think a full PC running Access is excessive where an in-vehicle dumb terminal or thin client will do.
 

Users who are viewing this thread

Top Bottom