Results 1 to 4 of 4
  1. #1
    keviny04 is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Apr 2015
    Posts
    128

    Subform autorefreshes when buund to Access table, but not when bound to SQL Server table

    I have a form set up as shown in the picture below. The subform on the left is bound to a local Access table. The subform on the right is bound to a local SQL Server 2014 Express table. Btw, this database serves no real-world purposes. It is specially made just for me to ask the following empirical question.



    If I update the textbox Field1 and click Save, the button's OnClick VBA code will update (via OpenRecordset, Edit, Update, etc.) the value of Field1 in both tables to which the two subforms are bound.

    It will also set focus on both forms:

    Me!subform1.SetFocus
    Me!subform2.SetFocus

    For reasons I don't really understand, when subform1 (which is bound to Access table) gets the focus, it auto-refreshes with the change I made to Field1 earlier.

    And here is my question: when subform2 (bound to SQL Server table) gets the focus, it doesn't auto-refresh likewise; why is that?

    And if I try to go into subform2 to edit Field1 directly, I get the error saying the value has been updated by another user, etc.

    Does SQL Server has something to do with all this? Is there any way to make subform2 auto-refresh likewise?

    Obviously, I can't upload my database since it is linked to SQL Server.


    Click image for larger version. 

Name:	ms access form 1-24-19.jpg 
Views:	7 
Size:	83.7 KB 
ID:	37110

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    I'm actually surprised the subform bound to the local table refreshes itself, but I work mainly with SQL Server back ends. You can force the issue with:

    Me!subform2.Form.Requery

    The write conflict can happen when you have a form bound to a table that you also update via code. The requery may resolve that.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    keviny04 is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Apr 2015
    Posts
    128
    Quote Originally Posted by pbaldy View Post
    I'm actually surprised the subform bound to the local table refreshes itself, but I work mainly with SQL Server back ends. You can force the issue with:

    Me!subform2.Form.Requery

    The write conflict can happen when you have a form bound to a table that you also update via code. The requery may resolve that.
    Hi pbaldy, is there a way without using Requery? I'm in a situation where Requery is undesirable. In my real-world application, I have a subform with thousands of records. Requery would move the record pointer to the top, and I would have to use code to move it back to the record shown before. All this record pointer movement up and down would create an ungainly sight for the user. Is there a way to make it autorefresh just like the other subform does?

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Nothing comes immediately to mind. That's a lot of records to pull across the network. I'd be looking at some way of limiting what's in the subform at any given time. Can it be limited by day/customer/employee/whatever so that it's not pulling that many records at once? It would seem a likely candidate for performance problems.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 56
    Last Post: 05-28-2017, 05:56 PM
  2. Replies: 6
    Last Post: 12-02-2016, 04:14 PM
  3. Export Data from Access 2003 Table to SQL Server 2012 Table.
    By Robeen in forum Import/Export Data
    Replies: 3
    Last Post: 02-26-2016, 02:07 PM
  4. Replies: 1
    Last Post: 09-03-2014, 10:48 AM
  5. Replies: 1
    Last Post: 04-26-2013, 05:30 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