By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,197 Members | 1,057 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,197 IT Pros & Developers. It's quick & easy.

Trying to set OrderBy in Report On Open Event

P: n/a
Hello

I am setting the Order By property of a subreport on the On Open Event of
the subreport
and I am getting the following error:

error number 2101 ( The setting you entered isn't valid for
this property.)

Oddly enough, event though I get this error , the Order By property settings
I am making on the On Open Event still work
when I open the subreport ; should I just capture this error and ignore it ?
I don't like doing that if there is a work around.

I get the same error if I try to set the Order By On , Filter, Filter On
properties.

If I open the subreport by itself (as a report ) , I don't get this error.

Here is the code I am using:

Dim MySort as String
Set MySet = MyDb.OpenRecordset("TblSortSub", DB_OPEN_DYNASET)
MySet.MoveFirst
If MySet!AllSort = -1 then
MySort = MySet!FirstField & "," & MySet!SecondField
Me.OrderBy = MySort
End If
MySet.Close

I am running Access 2000

Thanks
G.Gerard

Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"G.Gerard" wrote:
Hello

I am setting the Order By property of a subreport on the On Open Event of
the subreport
and I am getting the following error:

error number 2101 ( The setting you entered isn't valid for
this property.)

Oddly enough, event though I get this error , the Order By property settings
I am making on the On Open Event still work
when I open the subreport ; should I just capture this error and ignore it ?
I don't like doing that if there is a work around.

I get the same error if I try to set the Order By On , Filter, Filter On
properties.

If I open the subreport by itself (as a report ) , I don't get this error.

Here is the code I am using:

Dim MySort as String
Set MySet = MyDb.OpenRecordset("TblSortSub", DB_OPEN_DYNASET)
MySet.MoveFirst
If MySet!AllSort = -1 then
MySort = MySet!FirstField & "," & MySet!SecondField
Me.OrderBy = MySort
End If
MySet.Close

I am running Access 2000

Thanks
G.Gerard


Usually you use GroupLevel and the SortOrder properties to set the sort order of
a report.

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.