Results 1 to 8 of 8
  1. #1
    Redchrome is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2022
    Posts
    11

    Newer record being seen as older.

    I have a form with 4 buttons for newest / newer / older /oldest buttons. They mostly navigate properly, but recently, any new records are being treated as the oldest record. VBA is below, (The Resize line is for a separate portion and is working properly.)

    Any help as what may be reading newer records as older? I am self-taught in both my Access and VBA knowledge with assists from Google and YouTube, and have no clue where to look next. Thanks all in advance.



    Code:
    Private Sub Form_Load()
    
    
    DoCmd.GoToRecord , , acLast
    
    
    ReSizeForm Me
    
    
    Call subEnable
    
    
    End Sub
    Private Sub GoToFirstButton_Click()
     
        DoCmd.GoToRecord , , acFirst
        Call subEnable
     
    End Sub
    Private Sub GoToNextButton_Click()
     
        DoCmd.GoToRecord , , acPrevious
        Call subEnable
     
    End Sub
    Private Sub GoToLastButton_Click()
     
        DoCmd.GoToRecord , , acLast
        Call subEnable
     
    End Sub
    Private Sub GoToPreviousButton_Click()
     
     If Me.NewRecord Then
    
    
    Else
        DoCmd.GoToRecord , , acNext
        
    End If
        Call subEnable
     
    End Sub

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Is the form based on a sorted query
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Redchrome is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2022
    Posts
    11
    No query, it's a simple internal message system (Fields are Name, Event Date, Event Time, Subject, and Note) pulls data straight from the table with the following filter.

    ([EventDate] Between Date() and Date()-60)

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    As you are using a filtered table for your form , there is no inherent sort order so you have no control over the order it is displayed.
    Instead use a query, and sort by EventDate

    I notice your next button uses acPrevious & the Previous button uses acNext so presumably your data is intended to be sorted in descending order i.e. newest first => sort order = Descending.

    BTW You appear to be using my automatic form resizing code (ResizeForm Me). Hope its proving useful.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    Redchrome is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2022
    Posts
    11
    Quote Originally Posted by isladogs View Post
    As you are using a filtered table for your form , there is no inherent sort order so you have no control over the order it is displayed.

    BTW You appear to be using my automatic form resizing code (ResizeForm Me). Hope its proving useful.
    1) would a simple order on load in the form solve this?

    2) Yes I am using the Resizer. Working fairly well across our different monitor sizes and resolutions (smallest is a 13", biggest is a 32") with the biggest issue being our sub-form doesn't fully maximizes across screen, but it was redesign to still functional and readable by everyone. (This was a godsend find for me).

  6. #6
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    1. Change your form record source to a query sorted by EventDate in descending order. The filter can be applied in the query as well

    2. The maximum form width is 22.75 inches and automatic form resizing cannot bypass that built-in limitation.

    The reason is that form dimensions are in TWIPS (1440 twips = 1 inch) and use an integer datatype.
    1440 x 22.75 = 32760 which is very close to the integer limit of 32767

    Anyway, glad you are finding it useful.
    In case you haven't already seen it, the latest version of the app / code can be found at: https://www.isladogs.co.uk/automatic-form-resizing-1/
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  7. #7
    Redchrome is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2022
    Posts
    11
    1) Done and working, thank you.

    2) Form is way smaller and as designed in 800x600, it works on most monitors, but the subform ran off the right hand side on our smaller monitors. However, as this was not part of original topic, I am gonna mark this thread as solved. Would you mind if I email you directly to talk it over just a bit more?

  8. #8
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    1. Excellent. Glad you've got it working

    2. Certainly. Email link in my signature line below
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. Replies: 1
    Last Post: 04-08-2019, 02:24 AM
  2. Replies: 3
    Last Post: 02-28-2017, 03:18 PM
  3. Converting Module To Newer Version
    By JeffGeorge in forum Modules
    Replies: 6
    Last Post: 01-29-2015, 12:35 PM
  4. Replies: 3
    Last Post: 08-27-2012, 11:51 AM
  5. Older record disappearing when filtered
    By yohansetiawan in forum Access
    Replies: 4
    Last Post: 03-25-2012, 11:56 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