Rabu, 06 Maret 2013

RE: [MS_AccessPros] Stop moving to next record

 

Youssef-

Your form should have 0 defined in the TimerInterval property when the form
opens. I don't think it's a good idea to keep setting TimerInterval inside
the Timer event code - strange things can happen. I would do this:

Private Sub RunTimer_AfterUpdate()

' If user asked to turn on scrolling,

If Me.RunTimer Then

' Turn on the Timer Interval

Me.TimerInterval = Me.TheTimeInterval * 1000

Else

' Set to 0 to turn it off

Me.TimerInterval = 0

End If

End Sub

Private Sub Form_Timer()

' Make sure we're not at the end

If Me.Recordset.AbsolutePosition = Me.Recordset.RecordCount - 1 Then

' At the end - turn off the timer

Me.TimerInterval = 0

' And change the form control

Me.RunTimer = 0

Else

' Move to next

Me.Recordset.MoveNext

End If

End Sub

John Viescas, Author

Microsoft Access 2010 Inside Out

Microsoft Access 2007 Inside Out

Microsoft Access 2003 Inside Out

Building Microsoft Access Applications

SQL Queries for Mere Mortals

http://www.viescas.com/

(Paris, France)

From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Youssef
Sent: Wednesday, March 06, 2013 7:10 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Stop moving to next record

Hi,
I have a form to view the bible verses and i added the next code to automate
moving to next record.
but,
when it reachs to last record it generates and error.
so,
i need to make the code stop when it reaches to last record

the code is:-
----------------------------------------------------------
Private Sub Form_Timer()
Form.TimerInterval = TheTimeInterval * 1000
If RunTimer.Value = True Then
DoCmd.GoToRecord , , acNext
End If
End Sub
----------------------------------------------------------
where "TheTimeInterval" is a combo box that contains values from
1 to 10 to control the speed of moving between records

thanks in advance

[Non-text portions of this message have been removed]

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar