My Assistant
![]() ![]() |
|
|
Nov 6 2007, 09:46 AM
Post
#1
|
|
|
UtterAccess Guru Posts: 703 |
In one of my Access Databases I have a form that contains a continuous subform. The subform has enough space to display six records on the screen before the user would need a scroll bar to scroll down to see the rest of the records. Because of this, I want to set the form up so if there are six records or less in the subform, the scrollbars should disappear. More than six records, and I want the vertical scrollbar to appear. So in the OnCurrent event of the subform I placed the following code:
CODE Select Case Me.RecordsetClone.RecordCount Case Is < 6 Me.ScrollBars = 0 Case Else Me.ScrollBars = 2 End Select Which seems to work well, with one problem. I placed the code in the OnCurrent event of the subform so that as I delete and add records in the subform, it constantly recalculates whether or not it needs the scrollbars. The problem I am running into is if the I delete all of the records, or if I open the main form to a record that contains no records in the subform, the OnCurrent event never fires (presumably because because without any records in the subform, there can't be a current record). Does anyone know a way around this? |
|
|
|
Nov 6 2007, 09:55 AM
Post
#2
|
|
|
UtterAccess VIP Posts: 1,342 From: Barton-under-Needwood, Staffordshire, England |
Can you not run this code attached to the on current event of the PARENT form since you will always have a record in the main form but cannot guarantee one in the related subform - I'm not 100% sure that access will allow this but if it does then it should work.
regards Paul Edited by: Paul_Churchill on Tue Nov 6 9:56:42 EST 2007. |
|
|
|
Nov 6 2007, 02:18 PM
Post
#3
|
|
|
UtterAccess Guru Posts: 703 |
Paul,
Thanks or your help. Moving the even to the parent form worked. Thanks again. |
|
|
|
Nov 6 2007, 05:10 PM
Post
#4
|
|
|
UtterAccess VIP Posts: 1,342 From: Barton-under-Needwood, Staffordshire, England |
Great, I'm glad to know that Access did allow that
regards Paul |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 20th May 2013 - 05:39 PM |