Scroll problem on Continuous Form

E

Eddy

Hi

I have a continuous form, which design with Header, Detail and Footer.

When the number of records are many, where the Detail area cannot display
all of them, I can navigate the records on Detail by both "Vertical Scroll
Bar" and "Mouse Wheel".

My problem is under the situation, when the number of records are less,
where there is an empty area on Detail. In this situation, when I use the
mouse wheel to scroll down, the first record will disappear, but when I
scroll up, the first record cannot be gotten back. I have to use the arrow on
vertical scroll bar to get it back.

Any idea to aviod this issue?

By the way, I don't want to disable the Mouse Wheel.

Thanks
Eddy
 
Joined
May 29, 2012
Messages
1
Reaction score
0
Continuous Forms and Scrolling

Hi there,

What you need to do is always come back to the first record as long as you have less records than the end of your form.
Here below is a piece of code that will help you.

Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal count As Long)
Dim countRec As Integer

With "Name of your Form"
Me.RecordsetClone.MoveFirst
countRec = Me.RecordsetClone.RecordCount
If countRec < 8 Then 'Here the number 8 represents the maximum records I can see without needing to scroll down
DoCmd.GoToRecord acDataForm, "Name of your Form", acFirst
End If
End With
End Sub

Et voila, you will be able to scroll up and down as much as you like.

Best Regards
EGGS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top