Computer Learning Zone CLZ Access Excel Word Windows

The truth may be puzzling. It may take some work to grapple with. It may be counterintuitive. It may contradict deeply held prejudices. It may not be consonant with what we desperately want to be true. But our preferences do not determine what's true.

-Carl Sagan
 
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Back to Visitor Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
To OrderBy or not to OrderBy
j Hiler 

2 months ago
Something to tinker with.

1)The form in question consists of a parent form with a list box, and a sub form that is a multi-record form.  The selected entry in the list box controls the detail displayed in the sub form.
2)This code example is from the Form_Open sub procedure of the sub form.
3)Now open the parent form.
4)This is just a piece, but on the full form the results are entirely different if you turn on OrderBy and if you dont turn it on.  If I turn it on, I get nothing in the sub form.  If I leave it off things work perfectly.
This is not terribly import as I can get around it.  But it is an question.
And, for the record, I dont use orderBy very often, usually use an sql statement.


Private Sub Form_Open(Cancel As Integer)
   'Me.filter = "Country = 'USA'"
   'Me.FilterOn = True
   'Me.FilterOnLoad = True
   Me.OrderBy = "Date, transaction_type, ID"
   Me.OrderByOn = False
   Me.OrderByOnLoad = False
   If (Me.OrderByOn) Or (Me.OrderByOnLoad) Then
      Me.recordSource = "Finances_Transactions"
   Else
      Dim sqlStmt:  sqlStmt = "SELECT * FROM Finances_Transactions ORDER BY <>;"
                    sqlStmt = Replace(sqlStmt, "<>", Me.OrderBy)
      Me.recordSource = sqlStmt
   End If
End Sub

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Visitor Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 2/6/2026 9:14:20 PM. PLT: 1s