Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can form be like slideshow, auto moving from 1 record to next? 1

Status
Not open for further replies.

MushMouse

Programmer
Mar 29, 2004
65
US
I'd like my form to move automatically from 1 record to the next with an 8 second pause between each record. Is there a way to do this?

any advice would be most appreciated!
 
Hi

Look at the On Timer and Time Interval events for the form.





**********************************
There is more than one way to skin a cat...but who wants a skinned cat?
 
Here is a neat way to do this:

1. Add a command button to your form. Call this btnStartSlideshow

2. Add this code to the button's On_Click event, for an eight-second delay (the timer interval is in milliseconds, so for e.g. a three-second delay, you would type 3000)

Code:
    Me.TimerInterval = 8000

3. Add this code to the form's On_Timer event:

Code:
Private Sub Form_Timer()
    
On Local Error GoTo FTError1

    DoCmd.GoToRecord , , acNext

Exit Sub

FTError1:
    If Err = 2105 Then
        MsgBox "Slide Show Finished", vbExclamation
        Me.TimerInterval = 0
    Else
        MsgBox "Error during slideshow", vbCritical
        Me.TimerInterval = 0
    End If
    Resume FTEnd
    
FTEnd:
    On Error GoTo 0
End Sub

This will give you a slide show which starts when you click the button, and ends when the last record is reached. A message is displayed when the show finishes, or when an error occurs.

If you need a button to stop the slide show, just create another button similar to the [Start] button, with this code in its On_Click event:

Code:
    Me.TimerInterval = 0

I hope that this is useful.


Bob Stubbs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top