Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Developer Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Avoid Comma, Comma, Confusion
Donald Blackwell 
       
2 months ago
There's a form property that has been available in Access datasheet forms since version 1.0 and support for it was added to continuous forms in Access 2000 that I haven't found covered here even using search.

I've been adding the "SelTop" property for a bit to some of my form navigation in vba and it seems to work, in some cases, faster and cleaner, than DoCmd.GotoRecord; and you don't have to worry about remembering which comma you're one when completing the command.

I was wondering if this property is known to cause problems and that's why it hasn't shown up, or if it's just one of those that's flown under the radar since it was originally intended for datasheet forms and those are often avoided.

Donald Blackwell OP  @Reply  
       
2 months ago
Examples of usage:

Details' Go to the New Record Row:
Me.SelTop = Me.Recordset.Recordcount + 1
versus DoCmd.GotoRecord ,,acNewRec

' Go to the first record/row in a continuous form:
Me.SelTop = 1
versus DoCmd.GotoRecord ,,acFirst

' Go to the last record/row
Me.SelTop = Me.RecordSet.RecordCount
versus DoCmd.GotoRecord ,,acLast

' Go to the previous record/row
Me.SelTop = Me.SelTop - 1
versus DoCmd.GotoRecord ,,acPrevious

' Go to the next record/row
Me.SelTop = Me.SelTop + 1

And if you want to have 3 records show above the New Record row in a form:
Me.SelTop = Me.RecordSet.RecordCount + 1
Me.SelTop = Me.SelTop - 3
Me.SelTop = Me.RecordSet.RecordCount + 1
Donald Blackwell OP  @Reply  
       
2 months ago
Note: I did leave off Error Handling to try to keep the post shorter because it will throw an error if you try to go before SelTop = 1 or if you're on the New Record row (or the last record and add records is turned off) and you try to go to  Seltop + 1.
Richard Rost  @Reply  
          
2 months ago
Yeah, I remember playing with this property back in The Day (it was a Tuesday, BTW).

If memory serves (and Microsoft's documentation) there are also SelLeft, SelHeight and SelWidth properties that go with it.

I don't use datasheet view much, but I can see this being handy there. For continuous forms, the Goto... methods have always been what I've used. The Sel... methods are useful for selecting multiple records at a time though. For example, here I set the SelTop to 3 (3rd record) and the SelHeight to 3 (select 3 records)...
Richard Rost  @Reply  
          
2 months ago

Richard Rost  @Reply  
          
2 months ago
I'll add this to the list for a TechHelp video. Thanks for reminding me about it. Now if only I could come up with a good reason to use it... LOL

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer 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: 5/6/2026 11:25:18 AM. PLT: 0s