Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    Refresh/requery suform on main form from a different main form.

    I have a button on a pop up form that when it closes refreshes the subform on the next form that it opens.



    I need to refresh the form. I tried on load with no success.

    Code:
    Private Sub Form_Load()
    Me.frmBookingsSubJoin1.Requery
    Me.frmBookingsSubJoin2.Requery
    Me.Refresh
    End Sub
    And
    Code:
    Private Sub Form_Load()
    Me.frmBookingsSubJoin1.Form.Requery
    Me.frmBookingsSubJoin2.Form.Requery
    Me.Refresh
    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Don't understand, if form is just being opened, why do you need to run requery or refresh on it?
    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
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    Don't understand, if form is just being opened, why do you need to run requery or refresh on it?
    The first form is for viewing the records in the subform where as the second main form allows you to add those records (the subforms are locked and are for viewing and editing purposes but not adding purposes).

    So you are on the first form, you see a list of schools with some editable details like a contact (it's a continuous form) then you press a button on the main and it opens up a form for searching for the schools. When you click the school it ads the id to the table/subform and you then add that school into the records.

    Click image for larger version. 

Name:	Screen Shot 2013-08-21 at 9.59.27 PM.png 
Views:	14 
Size:	64.8 KB 
ID:	13516

    It's a work in progress. Basically when done adding the school on the other form, after closing I need it to refresh the form shown above subform.

    Click image for larger version. 

Name:	Screen Shot 2013-08-21 at 10.03.05 PM.jpg 
Views:	13 
Size:	56.2 KB 
ID:	13517

    This is the form to add a school to the other form.
    Last edited by June7; 08-21-2013 at 11:50 AM. Reason: merge posts

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Forcing a requery/refresh of a form from code in another form is easy, I do that. What I don't understand is putting that code in Load event of any form.
    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
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    Forcing a requery/refresh of a form from code in another form is easy, I do that. What I don't understand is putting that code in Load event of any form.
    It didn't work on the open form - I'm willing to try anything to get it to work.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I seem to have a similar situation:

    1. I have a form that is used to 'manage' records. Has tools to search and filter records and initiate tasks, such as create a new record or edit record or print report of record. Controls in unbound main form header for those operations and a subform displays existing records for quick review of data and as one option to select a record (locked against editing).

    2. Buttons initiate tasks to create new record or edit existing by opening a data edit form, user completes edits and closes form

    3. code in item 2 form custom 'close' button refreshes form/subform in item 1
    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
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    I seem to have a similar situation:

    1. I have a form that is used to 'manage' records. Has tools to search and filter records and initiate tasks, such as create a new record or edit record or print report of record. Controls in unbound main form header for those operations and a subform displays existing records for quick review of data and as one option to select a record (locked against editing).

    2. Buttons initiate tasks to create new record or edit existing by opening a data edit form, user completes edits and closes form

    3. code in item 2 form custom 'close' button refreshes form/subform in item 1
    So how do I ask that close button to refresh the other form?

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    The syntax I use is:

    Form_mainformname.Refresh

    In another form I use:

    Form_mainformname.subformcontainername.Requery
    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.

  9. #9
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    The syntax I use is:

    Form_mainformname.Refresh

    Form_mainformname.subformcontainername.Requery
    Mainform refreshes however, sub1 is supposed to requery showing only the schools with hosting unchecked. sub2 should be schools checked. Sub1 is showing results for those checked and unchecked and should be just unchecked (the refresh list button that refreshes the main form fixes that but I was hoping the syntax you provided would do that). Sub2 does nothing (it should see the new school added with checkbox true)

  10. #10
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    DoCmd.SaveMe.JoiningSchool = True
    Form_frmBookingJoining.frmBookingsSubJoin2.Requery
    Form_frmBookingJoining.Refresh
    DoCmd.OpenForm "frmBookingJoining"
    DoCmd.Close acForm, "frmBookingJoiningSearch", acSaveYes
    This is what I have on the close button.

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Apparently I don't understand your data relationships and form designs enough to respond intelligently. If you want to provide db for analysis, follow instructions at bottom of my post.
    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.

  12. #12
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    I think I'm partway there - it's refreshing the form just not refreshing the subforms..

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I am really confused. If frmBookingJoining is not open then there is nothing to refresh.
    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.

  14. #14
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    I am really confused. If frmBookingJoining is not open then there is nothing to refresh.
    You are using frmBookingJoining. It stays open. There is a button that you click it opens frmBookingJoiningSearch as a popup which allows you to search for schools and put in a name for the teacher who is joining in that form. When you close frmBookingJoiningSearch you go back to using frmBookingJoining (because it is already open) and when that happens I am hoping the subforms refresh with the newly added school.

  15. #15
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Still confused. If frmBookingJoining is open why do you show code to open it after code to refresh it?

    Close the Search form so record is committed to table then Requery the other form.

    DoCmd.Close
    Form_frmBookingJoining.frmBookingsSubJoin2.Requery

    If this doesn't work I won't be able to help further without reviewing the db.
    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.

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

Similar Threads

  1. Requery subform from main form
    By nswhit in forum Forms
    Replies: 7
    Last Post: 05-13-2013, 02:22 PM
  2. Requery Main Form, Keep Focus on Subform
    By burrina in forum Forms
    Replies: 8
    Last Post: 11-21-2012, 03:50 AM
  3. Requery subform after update of main form
    By gemadan96 in forum Forms
    Replies: 3
    Last Post: 10-17-2012, 02:33 PM
  4. Replies: 3
    Last Post: 10-10-2011, 06:33 PM
  5. Replies: 6
    Last Post: 01-13-2010, 02:41 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