Scrollbars propert problem

accesser2003

Registered User.
Local time
Tomorrow, 00:34
Joined
Jun 2, 2007
Messages
124
I have made it before but I dont know why it doesnt work this time:

I have a main form called:[LeavesEditorMain]
It contains subform called:[LeavesEditorTmp]

I want to programmatically set the [LeavesEditorTmp] scrollbars property to 0 (Neither) or 2 (Vertical) according to the value of number of records ot a tables called LeavesTmp. I wrote the code as follow in the On Load event of the [LeavesEditorMain] form

if dcount("*","[LeavesTmp]")>6 then
[Forms]![LeavesEditorMain]![LeavesEditorTmp].Scrollbars=2
else
[Forms]![LeavesEditorMain]![LeavesEditorTmp].Scrollbars=0
endif

the error I got is: the property or method is not supported by this object!
 
You need to use the correct syntax, and you're close.

Instead of this:

if dcount("*","[LeavesTmp]")>6 then
[Forms]![LeavesEditorMain]![LeavesEditorTmp].Scrollbars = 2
else
[Forms]![LeavesEditorMain]![LeavesEditorTmp].Scrollbars = 0
endif

Use this:

Code:
If DCount("*","[LeavesTmp]") > 6 Then
    Forms("LeavesEditorMain")!LeavesEditorTmp.Form.Scrollbars=2
Else
    Forms("LeavesEditorMain")!LeavesEditorTmp.Form.Scrollbars=0
End If

Forms is a collection. The bang (!) is an object in the collection (the subform). The dot (.) represents members of that object, including the object type (Form), and properties associated with that object (in this case, Scrollbars).
 
Highly Appreciaitve
 

Users who are viewing this thread

Back
Top Bottom