[AccessD] A2K: This should be easy

Darren Dick d.dick at uws.edu.au
Wed Mar 19 00:10:00 CST 2003


Hi Stuart
The following code just won't work, even with your 'time' suggestion <sigh>
I must be missing something really obvious. This should work.

I have a Recordset that has BookingID as its PrimKey
BookingTime is a DateTime Field formatted as short time in the table.
My Combo cmbInterval has the following as its row source
5;"5 mins";10;"10 mins";15;"15 mins";20;"20 mins"
And its row Source type is a value list.
It has 2 columns. First Column width = 1 Second is 2 cm.

Any other suggestions.
Many thanks so far.

Darren


''''''''''''''''''''''''''''
Dim dblMinutes As Double
Dim rs As DAO.Recordset
Dim x, y, z

dblMinutes = 1 / 24 / 60
Set rs = Me.Recordset

'Debug.Print (rs!BookingTime - cmbInterval / dblMinutes)
'Debug.Print Now() - Int(Now())

    While Not rs.EOF
        If (rs!BookingTime - cmbInterval / dblMinutes) >= Time() And Not
rs!WarningDone Then
                rs.Edit
                rs!WarningDone = True
                rs.Update
        End If
        rs.MoveNext
    Wend


-----Original Message-----
From: Stuart McLachlan [mailto:stuart at lexacorp.com.pg]
Sent: Wednesday, 19 March 2003 4:22 PM
To: Darren Dick; accessd at databaseadvisors.com
Subject: RE: [AccessD] A2K: This should be easy


If you are storing just a time in StartTime and print it as a normal
DateTime, you will  see a date of  30 December 1899
because that's Day 0.

The trouble is that Now() returns the date and time.  My mistake. You should
use Time() not Now()
 -  or alternatively "Now() - Int(Now())" which will just return the time
part of Now()


On 19 Mar 2003 at 10:56, Darren Dick wrote:

> Hi Stuart et al
> This didn't work either
> When I debug.print the line...
> (rs!StartTime - cmbWarningInterval /dblMinutes)
> I get a non related time (From memory it debug.printed as Some date in the
> 1800's and 1:00pm)
>
> My plan is to have this sitting as an open app and using the On_Timer
event
> to just check every 2-3 minutes or so for any Bookings that match the
> criteria  rs!StartTime = rs!StartTime - cmbWarningInterval
> Then do something to alert me.
> Then flag it as done.
>
> I Just dunno how to do it.<vbg>
> Many thanks
>
> Darren
>
>
>
> -----Original Message-----
> From: Stuart McLachlan [mailto:stuart at lexacorp.com.pg]
> Sent: Tuesday, 18 March 2003 12:47 PM
> To: Darren Dick; accessd at databaseadvisors.com
> Subject: RE: [AccessD] A2K: This should be easy
>
>
> You need to have a flag to let you know whether you have already triggered
> your event.
> Either include a Boolean WarningDone in you table or if you can't change
the
> table structure, create a temp table with all
> of today's bookings and include the boolean field in that temp table.
>
>
> Private Sub Form_Timer()
> Dim dblMinutes as Double
> dblMinutes = 1 / 24 / 60
>
> ....
> 'Set up recordset 'rs' to include required fields from bookings info
> 'including the flag
> .......
>
> While not rs.eof
> 	If (rs!StartTime - cmbWarningInterval /dblMinutes) => Now() _
>    	and Not rs!WarningDone Then
>                 ........
>       	    'Do whatever you want to with the info
>                 .........
>                 rs.Edit
>                 rs!WarningDone = True
>                 rs.Update
>            End If
>      rs.MoveNext
> Wend
> End Sub
>
> On 18 Mar 2003 at 12:22, Darren Dick wrote:
>
> > Hi Guys thanks for the replies.
> > I'll explain what I am doing. We have a booking app. (Not mine)
> > We can have many bookings entered for a day and even some at the same
> time.
> >
> > Amongst other things the Booking Start Time is captured by the other
app.
> > I display it in Me.txtStartTime
> > I also have a combo Me.cmbWarningInterval that has list entries like
> > 5,10,15,20,25,30,45,60 each representing minutes.
> >
> > If I select 15 from the combo I basically want a msgbox or some other
> event
> > to fire 15 minutes before the StarTime
> >
> > Should be simple
> >
> > Many thanks for listening to me
> >
> > Darren
> >
> >
> >
> > -----Original Message-----
> > From: accessd-admin at databaseadvisors.com
> > [mailto:accessd-admin at databaseadvisors.com]On Behalf Of Drew Wutka
> > Sent: Monday, 17 March 2003 6:01 PM
> > To: 'accessd at databaseadvisors.com'
> > Subject: RE: [AccessD] A2K: This should be easy
> >
> >
> > I know people are going to post about the DateDiff function.  But I'd
like
> > to get you thinking about what you are actually trying to do.
> >
> > Dates and Times are stored as numbers.  The date is the whole number,
> which
> > represents the number of days since 12-30-1899.  Thus, since days are
> whole
> > numbers, you can add or subtract days by simple math.  (ie, to get
> tomorrow,
> > it's Date()+1).  Times are the fraction of the day.  ie, .5 is noon, and
> .0
> > is midnight.  Thus, you can also just simply add or subtract values to
> > change the time.  (ie, to get an hour from now, use Now()+(1/24)).
> >
> > Does that make sense?  Also, another little known fact about the Date,
> Time
> > and Now functions.  They work both ways.  If you use this line of code:
> >
> > Date=Date()+1
> >
> > You've just set your systems date to tomorrow!  <grin>
> >
> > Drew
> >
> > -----Original Message-----
> > From: Darren Dick [mailto:d.dick at uws.edu.au]
> > Sent: Sunday, March 16, 2003 8:46 PM
> > To: Access Mail Group
> > Subject: [AccessD] A2K: This should be easy
> >
> >
> > Hello all
> > This should be simple.
> >
> > I have a control on a form (txtStartTime). Formatted for Short time
(i.e.
> > hh:mm)
> > I want to take say...5, 10 or 15 minutes from whatever time is in
> > txtStartTime
> >
> > So take away 15 from 11:00 should give me 10:45
> >
> > How do I do this.
> >
> > <Sigh> this should be easy. It probably is, I'm just brain fading.
> >
> > Darren
> >
> > _______________________________________________
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> > _______________________________________________
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
> > _______________________________________________
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
>
>
> --
> Stuart McLachlan
> Lexacorp Ltd
> Application Development,  IT Consultancy
> http://www.lexacorp.com.pg
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com


--
Stuart McLachlan
Lexacorp Ltd
Application Development,  IT Consultancy
http://www.lexacorp.com.pg




More information about the AccessD mailing list