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

    Requery ListBox on Mainform from Subform


    Having brain freeze and can't requery a Listbox on a mainform from the mainform's subform.

    I would have thought

    Code:
    Forms!frmBookingNewTheatre!ListTheatre.Requery
    would have worked

    suggestions?

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    The only example i could find of referencing a combo from a subform is
    Forms!frmFillerUnitsEdit![cmbFillerDest] = 0

    Here is an example from one subform to another sub. Still not a requery but should work?

    Forms!frmQuoteCreate.tglArchiveFilter.Caption = "Current"

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Try setting focus to the main form first!

  4. #4
    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 ItsMe View Post
    Try setting focus to the main form first!
    I thought about doing that but I haven't had much luck - what would be the path to setfocus from the mainform??

    And then if you have do you just refer to me.listtheatre.requery ??

  5. #5
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Forms!frmBookingNewTheatre!ListTheatre.SetFocus
    Forms!frmBookingNewTheatre!ListTheatre.Requery

    Works - thanking YOU

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I kept staring at the line of code wondering why. Then I looked up a couple lines in my code and Doh!

  7. #7
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Sorry to bring this one back up but can you requery a listbox on a main form using me.parent.form!listbox.requery ?

    have I got it wrong?

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    If you are calling it from within the forms module it is

    Me.listbox.requery

    from another module it is

    Forms!frmName!lstBox.Requery

    If you are in a subform's module then I believe you can also use

    Me.Parent.Parent!lstBox.Requery

    But I just use Forms!frmName!lstBox.Requery from a subform.

  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 ItsMe View Post
    If you are calling it from within the forms module it is

    Me.listbox.requery

    from another module it is

    Forms!frmName!lstBox.Requery

    If you are in a subform's module then I believe you can also use

    Me.Parent.Parent!lstBox.Requery

    But I just use Forms!frmName!lstBox.Requery from a subform.
    yeah that is what I had, forms!frmname etc

    I thought it was causing issues - like making it go blank but turns out it has something to do with data entry

    https://www.accessforums.net/forms/p...ext-38965.html

  10. #10
    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 ItsMe View Post
    If you are calling it from within the forms module it is

    Me.listbox.requery

    from another module it is

    Forms!frmName!lstBox.Requery

    If you are in a subform's module then I believe you can also use

    Me.Parent.Parent!lstBox.Requery

    But I just use Forms!frmName!lstBox.Requery from a subform.
    Should Me.Parent.Parent!lstBox.Requery actually be Me.Parent.Form!lstBox.Requery or Me.frmMainform.Parent!lstBox.Requery or Me.Parent.frmMainform!lstBox.Requery as Me.Parent.Parent!lstBox.Requery comes up with an error

  11. #11
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Try

    Me.Parent!lstBox.Requery

    and make sure you have a child and main link defined.

  12. #12
    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 ItsMe View Post
    Try

    Me.Parent!lstBox.Requery

    and make sure you have a child and main link defined.
    yeah I tried that I found it was because all the fields had to filled before they would show in the listbox - meaning I had to update the query to include if unfilled (relationship stuff I guess)

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

Similar Threads

  1. Requery Does Not Update Listbox Row Source
    By szucker1 in forum Forms
    Replies: 7
    Last Post: 02-11-2014, 08:58 AM
  2. Replies: 1
    Last Post: 11-07-2012, 05:31 PM
  3. Replies: 4
    Last Post: 03-30-2012, 01:47 AM
  4. Replies: 1
    Last Post: 11-29-2011, 01:37 AM
  5. after DAO update, listbox.requery not refreshing
    By EuniceH in forum Programming
    Replies: 2
    Last Post: 10-21-2011, 04:16 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