Results 1 to 10 of 10
  1. #1
    Sa'El is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2011
    Posts
    40

    Equivalent of "Refresh All"

    Hi All,



    When a splitform (or maybe datasheet form) is initially opened and no action is done, at the bottom in the navigation section where you can see the number of records, it's initially blank. If you click in a field then you see the number of records. Additionally, if you go to the Ribbon and click "Refresh All", you also see the number of records.

    Essentially, I would like the equivalent of "Refresh All" to be programmed, meaning, when a form loads I would like the number of records to be displayed at the bottom without the user having to click or anything. In my case the lack of clicking is significant since the "fields" the user could click are all hyperlinks (and besides, the user shouldn't have to do anything for the number of records to be generated). Me.Requery and it's siblings hasn't worked. I've checked the internet and this same question has been asked, and Me.Requery has been stated as a solution, but just like me, the originator of the question said it didn't work.

    Does anyone know how to program the equivalent? Thanks.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I don't use split form (looked at it when Access 2007 was new, didn't like it).

    I don't see this issue with stand alone form. I do see it sometimes with subform. In those instances, clicking into the subform seems to be only way to trigger the record count.

    Just did some testing with 2 different dbs. In one the subform had to be clicked, in the other did not. The first is synchronized to main form, the second is not.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Sa'El is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2011
    Posts
    40
    Hi June,

    So it's likely a side-effect of the split form...I can live with. It's unfortunate that you can have an icon that does the trick but not have a VBA equivalent for the icon.

    Thank you June.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Review: http://www.techonthenet.com/access/f...fresh_form.php

    I just tested the code with Access 2010 db (the first one that had to click the subform) and it worked.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Sa'El is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2011
    Posts
    40
    Thank you for the extra effort. I inputted the code first as a Load event it didn't work. When I created a button and tried inserted the same code, that didn't work too. The name of the button was correct (did another type of command and it worked). When it worked for you did you use a split form? Regardless, it's not that big a deal, though I'll keep that link for my records.

    Anyway, I do have another question entirely. Is there any code that captures when a record changes. Therefore, in a regular form and you move to the next record, is there an "On Next Record" equivalent or something?

    Reason is that initially I had single forms that weren't going to have multiple entries. For these forms I added code that After Update certain fields would be enabled/disabled. Now that I have multiple entries for a couple of these forms, I noticed that when you go to the next record, whatever code triggered for the first record is saved. Logically, I'm thinking that in these instances, once a new record is activated, the code for that form resets to the initial On_Load event.

    What do you think?

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I tested the command in the VBA immediate window. Not a split form.

    No "On Next Record" event.

    Try the OnCurrent event for code to set controls enabled/disabled. Or use Conditional Formatting. CF will allow enable/disable for each record independently of the others, whereas VBA applies same setting to all records.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Sa'El is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2011
    Posts
    40
    As the After Update depends on the values of the fields and not simply just being active, it doesn't look like the On Current would work. I wasn't aware that CF also effects enable/disable, and it would fit perfectly!

    I'm so grateful for your help June...I would propose on one knee, but since I fear rejection, I think I'll pass.

  8. #8
    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
    Can't test this with a Split Form, right now, but a problem with Access, vis-à-vis Record Counts, is that Access doesn't necessarily load an entire RecordSet when a Form first loads...and this quirk may be particularly problematic when loading the new Split Form. To facilitate custom Record Counts, in other types of Forms, the following can be used, and may be helpful, in your situation; it simply forces the Access Gnomes to load all of the RecordSet, on opening the Form, by moving to the Last Record then returning to the First Record:

    Code:
    Private Sub Form_Load()
      DoCmd.GoToRecord , , acLast
      DoCmd.GoToRecord , , acFirst
    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

  9. #9
    Sa'El is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2011
    Posts
    40
    Sorry for the delay. I was able to test out your suggestion Linq, and it worked on the Split Form! This was the kind of manipulation I was looking for to that would make the form do a harmless action programmatically to trigger the recordset to display.

    Thank you both for the help!

  10. #10
    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
    Glad we could help!

    Good luck with your project!

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

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. "Refresh All" Command
    By rkalapura in forum Programming
    Replies: 4
    Last Post: 02-11-2021, 08:31 AM
  2. Replies: 9
    Last Post: 01-27-2014, 09:53 AM
  3. Replies: 7
    Last Post: 06-27-2013, 10:56 AM
  4. Replies: 2
    Last Post: 02-21-2012, 01:35 PM
  5. Macro equivalent to "Me"
    By EES in forum Programming
    Replies: 1
    Last Post: 06-15-2011, 03:25 PM

Tags for this Thread

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