Mark A Matte
markamatte at hotmail.com
Fri Jan 9 08:52:40 CST 2004
Gustav, I could answer 1 of 2 ways... 1. I never really was good at division. or 2. I didn't know about the MOD operator. Either way...thanks for the insight. Thanks, Mark >From: Gustav Brock <gustav at cactus.dk> >Reply-To: Access Developers discussion and problem >solving<accessd at databaseadvisors.com> >To: Access Developers discussion and problem >solving<accessd at databaseadvisors.com> >Subject: Re: [AccessD] Formatting time - minutes to hour:minutes >Date: Fri, 9 Jan 2004 11:11:25 +0100 > >Hi Mark > >Are you aware that you can replace your creative counting loop with a >boring division ..? > >/gustav > > > > I wrote the following to calculate Minutes and Seconds...with a few > > changes...you could use it to calculate Hours and Minutes. I first > > calculate the SECONDS...then use a loop that increments a count by > > 1...multiply the counter by 60 and check againts SECONDS...when the > > Counter*60 is greater than SECONDS...Counter-1 = MINUTES and > > SECONDS-((counter-1)*60)=LeftOverSECONDS > > > Hope it helps... > > > Mark A. Matte > > > Private Sub cmdStop_Click() > > Me!EndDTTM = Now() > > Dim Seconds > > Dim RMmin > > Dim RMsec > > Seconds = DateDiff("s", Me!StartDTTM, Me!EndDTTM) > > Dim Check, Counter > > Check = True: Counter = 0 > > > Do > > Counter = Counter + 1 > > If Counter * 60 > Seconds Then > > RMmin = Counter - 1 > > RMsec = Seconds - ((Counter - 1) * 60) > > Check = False > > Exit Do > > End If > > Loop Until Check = False > > Forms!frmRecords!RMCallLengthM.Value = RMmin > > Forms!frmRecords!RMCallLengthS.Value = RMsec > > DoCmd.close > > End Sub > >_______________________________________________ >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com _________________________________________________________________ Get reliable dial-up Internet access now with our limited-time introductory offer. http://join.msn.com/?page=dept/dialup