Splitform Scrollbar Position

Menags

New member
Local time
Today, 16:54
Joined
Oct 31, 2011
Messages
2
Hi All,

I am trying to determine the position of the scroll bar for the datasheet section (as opposed to the form section) of a splitform. I intend to find the scroll bar position, perform a requery and then return to the same scroll bar position after requery.

I have attempted to use Stephen Lebans' SetGetSB functions. The functions work great as they are for determining the position of any scrollbars on the form part of the splitform (only needed to change the "scrollbar" class type to "NUIScrollbar"). In my case, the form part of the Splitform does not have any scrollbars (Scrollbar property set to Neither). I want to determine the postion of the scrollbars that automatically appear as the length of the datasheet is too large for the screen.


I think it may have to do with the API code references, maybe the hWnd window call? I'm not sure if it is possible to refer to the splitform datasheet scrollbars.

Any ideas would be greatly appreciated,

Many thanks,
Adam
 
There are several ways in which split forms fail to cooperate with VBA. Most of them involve the inability to separately address the parts of the form.

Split forms are a great beginner's tool but when planning anything complex, build the form using a subform structure.
 
This is not a difficult task. All you need to do is to get the PK ID of the record you are on and then set it back after requerying.

Code:
Dim lngID As Long
Dim rst As DAO.Recordset
 
lngID = Me!IDFieldNameHere
 
Me.Requery
 
Set rst = Me.RecordsetClone
 
rst.FindFirst "[IDFieldNameHere]=" & lngID
 
If rst.NoMatch Then
   Msgbox "Something went wrong.  Contact your Administrator"
Else
   Me.Bookmark = rst.Bookmark
End If

That should take you to the record. The current record on the form will be highlighted in the datasheet view.
 
Oops, sorry I thought you meant record. Scrollbar position would be something else and I agree with Galaxiom that Split Forms are limited in what you can do with them.

Sorry for the other code. Brainfart...
 
Thanks for the quick response guys,

I will re-configure my Access Database with subforms instead of the Splitforms and see if I can achieve the result I am after.

Cheers,

Adam
 

Users who are viewing this thread

Back
Top Bottom