Results 1 to 5 of 5
  1. #1
    seyfarth is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    3

    Proper way to reference subform object on requery?

    Hey guys, I'd really appreciate any help on this Screenshots of the form, macro, and error message at the bottom.



    Using Access '07 on Windows XP with a .accdb.

    What is the proper way to refer to objects in a subform's macro? Say I have subform X inside parent form Y. I have X's OnCurrent doing a requery of X's combo box C, and randomly (not consistently) I get "There is no field named "C" in the current record" errors when using form Y.

    I have a form with several subforms, with each subform split into tabs. Some of the subforms have combo boxes that use queries to gets lists of data from other tabs. This works fine.

    In order to keep the available options up to date as users move through the parent form's records, each subform using one of these combo boxes has an "On Current" macro that simply requeries the form's individual combo box.

    Most of the time this setup seems to work fine. However, seemingly randomly, Access throws some kind of scoping macro error, claiming it can't resolve the name of the object (combo box) I'm telling it to requery. This requires a user to close and reopen Access for now, and hope for the best on the next attempt.


    Parent Form:



    The subforms macro, requerying the combo box:


    Error message #1 that appears:


    Error message #2 that appears (immediately after clicking OK on error #1):

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    It would be much better if you uploaded the images here instead of somewhere else. Most of the public image sharing sites are blocked by my workplaces as I'm sure they are for several others too. So, I can't tell anything from the:








    .

  3. #3
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    So you are using a macro for this and not VBA, is that correct?

  4. #4
    seyfarth is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    3
    Quote Originally Posted by boblarson View Post
    So you are using a macro for this and not VBA, is that correct?
    Correct.
    Apologies for hosting externally. I've attached all the images with relevant names.

  5. #5
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Subform syntax in a macro would be easily gathered by using:
    http://www.btabdevelopment.com/ts/refer2sfrms

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

Similar Threads

  1. invalid database object reference
    By survivo01 in forum Access
    Replies: 1
    Last Post: 06-02-2011, 04:02 PM
  2. Replies: 8
    Last Post: 05-26-2011, 07:44 AM
  3. Invalid database object reference.
    By jgelpi16 in forum Programming
    Replies: 4
    Last Post: 04-11-2011, 02:48 PM
  4. Refresh Requery Subform
    By eww in forum Programming
    Replies: 1
    Last Post: 04-05-2011, 09:19 AM
  5. docmd.openform Invalid database object reference
    By snoopy2003 in forum Programming
    Replies: 5
    Last Post: 03-15-2011, 09:11 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