Hi there. I need help with a little problem.
I have a program that creates/maintains a database with bunch of records. The problem is that there are many records, and if i want to get to lets say record 30, i need to click on my NEXT button 30 times. My question is, is there a way to keep scrolling once the user pushes and doesnt release the NEXT button? I found a way, not sure if thats the best way - i used a timer. Heres a piece of code that i used to make that happen.
Private Sub cmdNext_Click()
'Checking for END OF FILE
'if not, then show the next record
If rs.EOF = False Then
'if this is END OF FILE, then imitate a click on a button
'that moves the current position to first record
'Checking for position after the MoveNext command
'intTotal holds the total number of records
If rs.AbsolutePosition < 0 Then cmdFirst_Click
If rs.AbsolutePosition >= intTotal Then cmdLast_Click
'RefreshDat sub updates all the fields with the data
'from the record in the current position
Private Sub cmdNext_MouseDown(button As Integer, Shift As Integer, X As Single, Y As Single)
Timer1.Enabled = True
Private Sub cmdNext_MouseUp(button As Integer, Shift As Integer, X As Single, Y As Single)
Timer1.Enabled = False
Private Sub Timer1_Timer()
I set the Interval property of timer1 to 100 so that the scrolling doesnt go too fast. This works, of course, only with the next button. I can make it work with the previous button too - with a global boolean variable i guess. The question is - is there an easier way to do the task? I tried playing around with the mousedown/mousemove events, but no luck so far.
Thanks for any help!