Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    Radtastic10 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    65
    Code:
    Private Sub Form_AfterUpdate()
    Forms![MainForm]![SubForm].Requery
    End Sub
    I also have a sub that happens on Open, but that is just to make sure that it opens to a new record.

  2. #17
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Is [Subform] the name of the control on the main form that contains the subform?

    If so, then your command should be : Forms![MainForm]![SubForm].form.Requery

    If [Subform] is not the name of the control, then you need to change it.

  3. #18
    Radtastic10 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    65
    I tried it with the control, it popped up with an error that reads "Object doesn't support this property or method. When I look at the code the requery line is highlighted

  4. #19
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,463
    If the names of your forms are not MainForm and SubForm which they probably should not be, then the code will not work. You need to put the actual names of your forms in those spots.

    Forms![YourMainFormName]![YourSubFormName].form.Requery

    THis needs to go on the AfterUpdate on YourMainForm, not the SubForm.

  5. #20
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    You need to put the actual names of your forms in those spots.
    That's not correct. A subform is not part of the Forms! collection, and you cannot reference it that way - you have to use the [controlname].form ... method.

    And there are some advantages to that - it means you can change the subform being used "on the fly", using VBA, without having to change any code.

  6. #21
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,463
    Usually my control name is the same as form name. Point is we using Mainform and Subform as reference, not actual names.

  7. #22
    Radtastic10 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    65
    I am quite aware that you are using them as a reference and not actual names. I was also using them as such.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Data Entered into Form to update on Table
    By aussiegrl in forum Forms
    Replies: 2
    Last Post: 02-22-2016, 03:27 PM
  2. Replies: 3
    Last Post: 10-04-2015, 10:17 AM
  3. Replies: 3
    Last Post: 01-09-2015, 12:24 AM
  4. Replies: 14
    Last Post: 08-12-2014, 06:33 AM
  5. Replies: 2
    Last Post: 11-30-2013, 02:53 AM

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