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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fast Forward Through Records

Status
Not open for further replies.

annie52

Technical User
Mar 13, 2009
164
US
I have navigation buttons on my form but I want to be able to "fast forward" through records if I keep the mouse button depressed.
 
You can use the AutoRepeat property. Help says:

"You can use the AutoRepeat property to specify whether an event procedure or macro runs repeatedly while a command button on a form remains pressed in."



 
Hi, Remou. Okay, I set the AutoRepeat property on one of my buttons but it doesn't work. Could it be because the OnClick event for my cmdPrevious button does other things than just moving to the previous record?
 
Apologies, I should have read further. This property cannot be use to move to the next record. It looks like you need a loop.

 
I don't think I've ever used a loop before. I tried this but it doesn't work:

Do Until MouseUp
DoCmd.GoToRecord , , acPrevious
Exit Do
Loop

Then, I tried it without the Exit Do line and it took off running. I had to Ctrl+Break to stop it.

A little more guidance, please?
 
I think the timer might be best. Here is a rough sketch.

Code:
Option Compare Database
Option Explicit

'Module level declaration
Dim blnForward As Boolean

Private Sub cmdForward_Click()
blnForward = Not blnForward

If blnForward = True Then
    Me.cmdForward.ForeColor = vbGreen
    Me.TimerInterval = 1000 '1 second
Else
    Me.cmdForward.ForeColor = vbBlack
    Me.TimerInterval = 0 'Stop
End If
End Sub

Private Sub Form_Timer()
If Me.Recordset.AbsolutePosition + 1 < Me.Recordset.RecordCount Then
    DoCmd.RunCommand acCmdRecordsGoToNext
Else
    Me.cmdForward.ForeColor = vbBlack
    Me.TimerInterval = 0 'Stop
End If
End Sub

 
Well, I guess I'm like a dog with a bone 'cause I'm still working on the loop. That seems the way I really want to go and I'm sure, once I get the hang of it, it will be useful to me in other ways.

Remou, thanks for your input. If you (or anyone else) has more feedback, I welcome it.
 
I should not have mentioned loops, I tried it out and it does not really work.

You do not say what you wish to achieve, perhaps it would be best to just jump a suitable number of records?

 
How are ya annie52 . . .

This would be so much easier if you didn't mind using the keyboard [blue]arrow keys![/blue] [thumbsup2]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Thanks missinglinq but I kinda like my own buttons and don't want to replace them. I may have to revisit that decision if my users start complaining.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top