Results 1 to 12 of 12
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919

    Open form with last record of recordset already at the bottom of continuous form.

    Is there a way to open a form with the last record of the RecordSource recordset already at the bottom of a continuous form?

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    If you're saying that you want the last record in the Recordset to be the Current Record/have Focus, when the Form opens:
    Code:
    Private Sub Form_Load()
     DoCmd.GoToRecord , , acLast
    End Sub

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Thanks Linq,
    That's a good start. Now if I could force the OnLoad event to backup about 12 records or so the form would open filling the display.
    Bill

  4. #4
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    If 12 is your magic number, perhaps DoCmd.GoToRecord , , acNext,-12 ? I believe you will generate an error if there are not enough records to move back 12, so then what?
    To get fancier, do a DCount on the records and move back 12 if there are enough, otherwise, move to some other value or go to the first.

  5. #5
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Hummmmmm! I thought I could "send rectangle to the back" so that tb's were in front. Haven't been able to figure out how to do that.

  6. #6
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Got your threads mixed up?

  7. #7
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    I don't know why the code below had no effect in the OnLoad event:

    Code:
    RecCount = Me.Count - 12
    If RecCount >= 0 Then DoCmd.GoToRecord , , acFirst, RecCount
    I ran the code on a test RecordSource that contained about 25 records, so RecCount (integer) evaluated to 13 and the DoCmd ran but without having any effect.

    I also tried "DoCmd.GoToRecord , , acLast, -12" as a test but that too had no effect either.

  8. #8
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    If you look again, I wrote acNext, not acFirst. Also, the way you wrote this, it will try to move back if the recordcount = 0 or move back 12 if it is even just 1, resulting in an error. I would try
    Code:
    RecCount = Me.RecordsetClone.RecordCount
    If RecCount > 13 Then DoCmd.GoToRecord , , acNext, RecCount - 12
    If the the last row is blank because it is for a new record, you might have to adjust 12 to suit your needs. The count has to exceed the number you are trying to move back.

  9. #9
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Ah yes, I did miss "acNext".

    BTW, the number 12 is not the best idea I've had of late. It's a guess as to the size of the nominal window that opens when the app is launched. As I recall, there's no way to determine "how many" instances there are of the Detail section of the form when it opens. The height of the header, detail and footer isn't enough. Maybe I missed something in the past that would help?

  10. #10
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    "As I recall, there's no way to determine "how many" instances there are of the Detail section of the form when it opens."
    Are you not referring to the recordsetclone.recordcount? You can control the height of the record rows and even the height of the detail section, but that's a slippery slope. One factor that comes in to play when trying to manipulate things this way is the screen resolution of the user. There is only so much I will worry about when it comes to design, and I've read enough on the subject to know that re-jigging the render of forms to suit different resolutions is not worth the effort. If a department had guys using 800x600 when everyone else was using 1028x764, guess who had to scroll?
    Perhaps you'd want to play with the row height on form load, if for no other reason than to gain experience: Me.RowHeight = 300
    No slight intended, but I'm also beginning to wonder if your focus is a bit more on the mundane aspects which really don't matter. Perhaps a picture of your form would give clues as to whether or not design changes could be suggested or if it looks fine the way it is.
    Last edited by Micron; 11-28-2015 at 07:39 PM. Reason: clarified what was not worth the effort

  11. #11
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    I can understand how you might wonder if I was immersed in the mundane. There were really only two issues of any importance to the app. One, that the app open with the last record as close to the bottom of the form's window and two that I could manage to establish a "Top" point to assign to Allen Browne's popup calendar, the desire with the latter having the popup's mid-point adjacent to the "Date" control when the user clicks on the date.

    I did spend a bit more time on these issues than I ordinarily would but for some reason these otherwise piddly items captured my attention. Anyway, knowing the height of sections 0, 1 and 2 plus the height of the Access window, I can establish a baseline upon which I can position Allen's popup. All would be relative to whatever the screen resolution might be. Does anyone really still have 800x600 displays

    Bill

  12. #12
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    As of last July when I left, yes! Hard to believe, I know. Then again, you are designing for version 2003...
    I guess that is why you are not just using the popup calendar for date fields.

    All would be relative to whatever the screen resolution might be
    Maybe, maybe not. Take a look at this:
    https://www.accessforums.net/forms/o...sor-23837.html

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Continuous search form won't open selected record in view form.
    By IncidentalProgrammer in forum Programming
    Replies: 20
    Last Post: 03-24-2015, 02:53 PM
  2. Replies: 4
    Last Post: 11-21-2014, 09:56 PM
  3. Moving Rows in Continuous Form Up/Down and Top/Bottom
    By RichardAnderson in forum Forms
    Replies: 2
    Last Post: 01-22-2014, 02:43 PM
  4. Replies: 7
    Last Post: 06-13-2012, 06:27 PM
  5. Open form and locate it on the bottom
    By Dominaz in forum Forms
    Replies: 4
    Last Post: 11-17-2011, 08:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums