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

sorting data on continous form

P: n/a
I have a continous form based on 1 table.
On the form I have a button that sets the OrderBy to as follows

DataSource = Me.RecordSource

If Me.OrderBy = DataSource & ".PaymentDate DESC" Then
Me.OrderBy = DataSource & ".PaymentDate"
Exit Sub
End If

Me.OrderBy = DataSource & ".PaymentDate DESC"

This works fine most of the time but sometimes clicking the button doesn't
sort the data. This usually happens after data has been added to the
underlying table and Requery has been run on the form. I can exit the form.
re-open it and click the up or down arrows once then my sort button will
work.

Any ideas on how to make the button work all time?


Dec 15 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
After setting the order, make sure OrderByOn is turned on:
Me.OrderByOn = True

Before it can change the sorting, Access has to save any edits that are in
progress. It is always a good idea to do this explicitly:
If Me.Dirty Then Me.Dirty = False

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Karl" <so*****@sbcglobal.bizwrote in message
news:yO******************@newssvr29.news.prodigy.n et...
>I have a continous form based on 1 table.
On the form I have a button that sets the OrderBy to as follows

DataSource = Me.RecordSource

If Me.OrderBy = DataSource & ".PaymentDate DESC" Then
Me.OrderBy = DataSource & ".PaymentDate"
Exit Sub
End If

Me.OrderBy = DataSource & ".PaymentDate DESC"

This works fine most of the time but sometimes clicking the button doesn't
sort the data. This usually happens after data has been added to the
underlying table and Requery has been run on the form. I can exit the
form. re-open it and click the up or down arrows once then my sort button
will work.

Any ideas on how to make the button work all time?

Dec 15 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.