Automatic Page Creation

Kempes

Registered User.
Local time
Today, 10:58
Joined
Oct 7, 2004
Messages
327
Hi all,

Not sure if this is possible in access but I currently have a continuous form showing all records from a table.

when the records exceed the page space vertically, you can scroll up and down using the scroll bar, or scroll wheel on the mouse. However, I don't want to use this as there appears to be a bug when scrolling down and up, it fails to display the first record. It can be viewed again by clicking on the up arrow above the scroll bar, but this is not ideal.

For this reason, what I would like to do is have a set number of records per page, lets say 25. When it reaches 25, it will automatically create a new page and give the option for page 2, which will show the next 25, and so on. Much like how the pages work on this forum. 25 threads per page.

Does anyone know how this could be achieved, or is there an alternative method?

Acc 97

I've done a quick search but found nothing.

Many Thanks
Kempes
 
It's a lot of work and potentially uses the sql keywords "IN", "NOT IN" and "TOP". You may even be able to figure it out using DAO/ADO in VBA.
 
And what happens when you run out of form? The maximum length of the Detail Section of a form is 22 inches, regardless of how many pages you have/create.

The only thing I can think to address your dilemma would be to have two buttons in your header, a "ScrollDown" button and a "ScrollUp" button. You'd need this code:
Code:
Private Sub Form_Load()
DoCmd.GoToRecord , , acLast
DoCmd.GoToRecord , , acFirst
End Sub
In the next bit of code, if you decide to modify the number of records scrolled by changing values for the variables Limits and Repeats, Repeats must always equal Limits + 2.
Code:
Private Sub ScrollDown_Click()
Dim Limits As Integer
Dim Repeats As Integer

Limits = 23
Repeats = 25
If RecordsetClone.RecordCount - CurrentRecord > Limits Then
 For I = 1 To Repeats
  DoCmd.GoToRecord , , acNext
 Next I
Else
 For I = 1 To (RecordsetClone.RecordCount - CurrentRecord)
  DoCmd.GoToRecord , , acNext
 Next I
End If
End Sub
If you modify Repeats in the code above, remember to change it in this code to match.
Code:
Private Sub ScrollUp_Click()
Dim Repeats As Integer

Repeats = 25

If CurrentRecord > Repeats Then
 For I = 1 To Repeats
  DoCmd.GoToRecord , , acPrevious
 Next I
Else
 For I = 1 To (CurrentRecord - 1)
  DoCmd.GoToRecord , , acPrevious
 Next I
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom