An automatic time + 30mins

connordrew

Registered User.
Local time
Today, 06:09
Joined
Aug 14, 2003
Messages
22
Hi,

I have a time commence field and a time end field. Already in the Time In Field, i have the =now() and when clicked, this fills in the current time. I would like to automatically fill the Time End field by 30minutes.
So if a call starts at 13:23 I would like an automatic time to show as 13:52 in Time End. How can this be done?

Many thanx
 
In the ControlSource of the TimeEnd textbox - it's not a field ;) :

=DateAdd("n", 30, [txtTimeStart])

If you have a TimeEnd field in your table then you can remove it; it's unnecessary.
 
connordrew said:
Hi,

I have a time commence field and a time end field. Already in the Time In Field, i have the =now() and when clicked, this fills in the current time. I would like to automatically fill the Time End field by 30minutes.
So if a call starts at 13:23 I would like an automatic time to show as 13:52 in Time End. How can this be done?

Many thanx

try this - change text2 and text4 to be the names of your text boxes.

Private Sub Text2_Click()
Text2 = Format(Now, "hh:nn")
Text4 = DateAdd("n", 30, Text2)
End Sub
 
Mile-O-Phile said:
In the ControlSource of the TimeEnd textbox - it's not a field ;) :

Actually, this might be better for the ControlSource:

=IIf(IsNull([txtStartTime]), "-", DateAdd("n", 30, [txtStartTime]))

The Time format can be set in the textboxes themselves with the Format property.
 
one problem guys,

I have made the form direct from the table data rather than from a query.

Where would I type:
=IIf(IsNull([txtStartTime]), "-", DateAdd("n", 30, [txtStartTime]))

many thanx
 
In the EndTime (or whatever it's called) textbox's ControlSource - you can remove what's already there, and then delete the EndTime (or whatever) field from your table. Remember txtStartTime, as I sais, is just the assumed name of your textbox.
 

Users who are viewing this thread

Back
Top Bottom