Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
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!