How to calculate tours and pass value

  • Thread starter Thread starter AndyB
  • Start date Start date
A

AndyB

I have a field named Time1. I have had the database for about 1 year and
I want to add an additional field called
"Tour" based on a 24 hour clock there are three Tours
0700 by 1535
1535 by 2335
2335 by 0700
I count the events per Tour on a record using these Control values.

=Sum(Abs([time1]>=#11:35:00 PM# Or [time1]<#7:00:00 AM#))
=Sum(Abs([time1]>=#3:35:00 PM# And [time1]<#11:35:00 PM#))
=Sum(Abs([time1]>=#7:00:00 AM# And [time1]<#3:35:00 PM#))

I want to use VBA to set the new field on a form to indicate the tour
involved once Time1 is entered.
I am trying such basic things as Time1_AfterUpdate

me.time1=me.tour
just to send the time in and it is not working. So getting it to
work after a tour calculation is a few steps ahead.

Basically I am stuck

ANdy Benjamin
 
Hi.

Try something like this in the afterupdate event of the
time1 control:


dim strTour as string

if ([time1]>=#3:35:00 PM# And [time1]<#11:35:00 PM#) then
strtour = "1535 by 2335"
if ([time1]>=#11:35:00 PM# Or [time1]<#7:00:00 AM#) then
strtour = "2335 by 0700"
if ([time1]>=#7:00:00 AM# And [time1]<#3:35:00 PM#) then
strtour = "0700 by 1535"

tour.setfocus
tour.text = strtour

Regards

B
 
Sorry,

that should be:

if ([time1].value>=#3:35:00 PM# And
[time1].value<#11:35:00 PM#) then strtour = "1535 by 2335"
if ([time1].value>=#11:35:00 PM# Or [time1].value<#7:00:00
AM#) then strtour = "2335 by 0700"
if ([time1].value>=#7:00:00 AM# And [time1].value<#3:35:00
PM#) then strtour = "0700 by 1535"

B
-----Original Message-----
Hi.

Try something like this in the afterupdate event of the
time1 control:


dim strTour as string

if ([time1]>=#3:35:00 PM# And [time1]<#11:35:00 PM#) then
strtour = "1535 by 2335"
if ([time1]>=#11:35:00 PM# Or [time1]<#7:00:00 AM#) then
strtour = "2335 by 0700"
if ([time1]>=#7:00:00 AM# And [time1]<#3:35:00 PM#) then
strtour = "0700 by 1535"

tour.setfocus
tour.text = strtour

Regards

B

-----Original Message-----
I have a field named Time1. I have had the database for about 1 year and
I want to add an additional field called
"Tour" based on a 24 hour clock there are three Tours
0700 by 1535
1535 by 2335
2335 by 0700
I count the events per Tour on a record using these Control values.

=Sum(Abs([time1]>=#11:35:00 PM# Or [time1]<#7:00:00 AM#))
=Sum(Abs([time1]>=#3:35:00 PM# And [time1]<#11:35:00 PM#))
=Sum(Abs([time1]>=#7:00:00 AM# And [time1]<#3:35:00 PM#))

I want to use VBA to set the new field on a form to indicate the tour
involved once Time1 is entered.
I am trying such basic things as Time1_AfterUpdate

me.time1=me.tour
just to send the time in and it is not working. So getting it to
work after a tour calculation is a few steps ahead.

Basically I am stuck

ANdy Benjamin



.
.
 
Back
Top