Results 1 to 9 of 9
  1. #1
    dotcanada is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2015
    Location
    Alberta, Canada
    Posts
    44

    Refreshing subform

    Hi all.

    This may get a little confusing so I apologize in advance, but please bear with me.



    I have a database where the main form (frmPlayerInfo) has a subform (subfrmPlayerContract) in single form view and has a button control to add new records. This subform has a subform (subfrmPlayerSalaries) which is also in single form and also has a button control to add new records. And, again bear with me, this subform has another subform (subfrmPlayerCareerSalaries) however this one is in datasheet view. So basically it's one form on top of another.

    That being said, let's go to subfrmPlayerSalaries which has the datasheet subform. When I enter in data into subfrmPlayerSalaries, then hit the add record button, the datasheet subform does not update with the newly entered data from subfrmPlayerSalaries, however the data does get saved.
    Any ideas is appreciated.
    Last edited by RuralGuy; 08-10-2016 at 01:27 PM. Reason: Fixed the Title spelling

  2. #2
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    On the AfterUpdate property of subfrmPlayerSalaries, Requery the datasheet subform.

  3. #3
    dotcanada is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2015
    Location
    Alberta, Canada
    Posts
    44
    No dice.

    Still pretty new at VBA. What would be the correct code in the After Update of subfrmPlayerSalaries? There currently is no existing code for this event.

  4. #4
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    Something like:
    Forms![frmPlayerInfo]![subfrmPlayerContract]![subfrmPlayerSalaries]!subfrmDatasheet.Requery

  5. #5
    dotcanada is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2015
    Location
    Alberta, Canada
    Posts
    44
    Still nothing. When I hit add record, everything in the datasheet still disappears. When I refresh the entire form, the data in the datasheet reappears, but as soon as I hit "add record" it disappears.

    To add some more info, I have other subforms that doesn't have this problem. For instance, my main form has another subform called subfrmBuyoutRST which is in single form view as well as having an add record button. This subform has it's own subform called subfrmBuyoutRSTSalaries which is in datasheet view. So, unlike the initial scenario in the first post, this has one less subform. When I place data in subfrmBuyoutRST and hit the add record button, the data that I just entered appears in the subfrmBuyoutRSTSalaries datasheet.

  6. #6
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    So the datasheet subform and the Salaries subform both look at the same data table?

  7. #7
    dotcanada is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2015
    Location
    Alberta, Canada
    Posts
    44
    Yes.

    One thing I tried is I moved the datasheet subform from subfrmPlayerSalaries to the subfrmPlayerContract subform.

    It got rid of the disappearing issue when hitting add record. But it doesn't update the datasheet.

  8. #8
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    To restate. Salaries and Datasheet RecordSource are the same table? You add a record in subfrmPlayerSalaries, AfterUpdate you refresh subfrmDatasheet but the new record does no show? But if you go to the table, the record is in there?

    If you close the form and open again, does the record now show on Datasheet? Have to ask, could it be a scrolling or sorting issue on Datasheet?

  9. #9
    dotcanada is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2015
    Location
    Alberta, Canada
    Posts
    44
    Got it!!

    After moving the datasheet from subfrmPlayerSalaries to subfrmPlayerContract, I forgot to re-enter the After Update event in subfrmPlayerSalaries. (Forms![frmPlayerInfo]![subfrmPlayerContract]!subfrmPlayerCareerSalaries.Requery)

    Works great now.

    Thanks for your help and time. Cheers.

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

Similar Threads

  1. Refreshing Data
    By Pure Salt in forum Access
    Replies: 2
    Last Post: 05-12-2014, 11:52 AM
  2. Refreshing a listbox
    By PatrickCairns in forum Programming
    Replies: 9
    Last Post: 12-07-2012, 05:26 PM
  3. Refreshing a combo box
    By tcheck in forum Access
    Replies: 3
    Last Post: 02-21-2012, 12:29 PM
  4. refreshing tables?
    By danbo in forum Access
    Replies: 1
    Last Post: 12-23-2011, 03:05 AM
  5. SubForm not refreshing
    By hawkins in forum Access
    Replies: 2
    Last Post: 08-16-2011, 04: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