How do I add the current time to a table using a check box

PeterCol

New Member
Joined
Jun 26, 2003
Messages
18
I need to record when people arrive in my surgery and when they leave for a waiting time audit. Appointments are available on an Access table but rather than recording by hand or typing times in it would be easier to use a tick box or such that puts the current time into the record. I am new to programming access - can anyone point me in the right direction? I envisage say clicking on the patient record to bring up a form with that patient's name and buttons to press for arrived and departed.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Re: How do I add the current time to a table using a check b

I assume you know that you would need to do this sort of thing in code. I'm envisioning two controls: One a check box/option button/command button or whatever you like and beside it a text box that you would disable. In the first control's on-click event, you would write something like:
Code:
Your_Control_On_Click()
Me.Your_Text_Box=Now()
End Sub

This writes the current date/time into that disabled text box. You would then duplicate this for departure (so, four controls, total). You could also set up a little error-handler in the departure control's event-procedure to validate whether or not there is an arrival time. That would go something like:
Code:
Your_Departure_Control_On_Click()
If IsNull(Me.Your_Arrival_Text) Then
Msgbox "There is no arrival time!"
Exit Sub
Else:
Me.Your_Departure_Text_Box=Now()
End If
End Sub
 
Upvote 0
Re: How do I add the current time to a table using a check b

if you are new to access, you may prefer to use a macro. for your form button, run a macro that will "SetValue" of your [intime] field to Now().

Then create another macro to do the same for for [outtime]
 
Upvote 0
Re: How do I add the current time to a table using a check b

Thanks folks. I'll need to puzzle on this one for a bit.
 
Upvote 0

Forum statistics

Threads
1,221,537
Messages
6,160,394
Members
451,645
Latest member
hglymph

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top