Results 1 to 13 of 13
  1. #1
    Madmartigan is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    36

    Combobox To Update Subform

    I have searched and searched and cannot find a solution for my problem.

    On a tabbed form I have a datasheet subform. Above it is a combobox. In the query criteria for the subform I have the following:

    [Forms]![fMain Menu]![Customers]

    Everything works great but when I select a customer in the combobox, the subform does not refresh on its own. If I select a customer in the combobox, it get an error:

    "Microsoft Office Access can't find the object 'Form!qCustomer Balances by Reason/Year subform.'

    If I click "OK" and press F5, the subform refreshes as I want it to. I have played around with numerous variations of code in the AfterUpdate event in the combobox property and nothing works. Help?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    By 'tabbed form' do you mean a Navigation 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.

  3. #3
    Madmartigan is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    36
    I'm not familiar with a navigation form. I'm referring to the tabs you can create while in Design view -> Design -> Controls ->Tab Control

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    What is the SourceObject for the subform container control - table, query, form, report?

    What is the code behind the combobox?

    The / in the form name might be an issue. Also appears to be spaces. Enclose in brackets.

    Form![qCustomer Balances by Reason/Year subform]

    Advise no spaces or special charactures/punctuation (underscore is exception) in naming convention.
    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
    Madmartigan is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    36
    Quote Originally Posted by June7 View Post
    What is the SourceObject for the subform container control - table, query, form, report?
    If I understand the question correctly, the source object is the query:

    qCustomer Balances by Reason/Year

    Quote Originally Posted by June7 View Post
    What is the code behind the combobox?
    Row Source:

    Code:
    SELECT [tChargeback Main Table].[Master Acct] FROM [tChargeback Main Table] GROUP BY [tChargeback Main Table].[Master Acct] ORDER BY [tChargeback Main Table].[Master Acct];
    After Update:

    Code:
    [Form]![qCustomer Balances by Reason/Year subform].Requery
    Quote Originally Posted by June7 View Post
    The / in the form name might be an issue. Also appears to be spaces. Enclose in brackets.

    Form![qCustomer Balances by Reason/Year subform]

    Advise no spaces or special charactures/punctuation (underscore is exception) in naming convention.
    Ok, I'll try removing the "/" and spaces.

    See anything else that would cause issues?

  6. #6
    Madmartigan is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    36
    I removed the special characters/spaces and it had no affect.

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    I always name subform container control different from the object it holds, like ctrDetails.

    What is the name of container control?

    Try:

    Me.ctrDetails.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.

  8. #8
    Madmartigan is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    36
    Quote Originally Posted by June7 View Post
    I always name subform container control different from the object it holds, like ctrDetails.

    What is the name of container control?
    Sorry, working with forms at this level is still new to me. Can you explain in greater detail what you're referring to?

    Where is the name of the container control housed?


    Quote Originally Posted by June7 View Post
    Try:

    Me.ctrDetails.Requery
    Can this go in the After Update field in the properties section or is this done in VBA? (I'm very limited with VBA ability).

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    A subform is created by installing a subform/subreport container control on another form. The container has SourceObject property. The SourceObject can be a table, query, form, report.

    Like any control, the container has Name property.

    Click once on the subform and container is selected, click again and the source object in the container is selected.
    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.

  10. #10
    Madmartigan is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    36
    I wasn't able to follow that but after some additional research here, I think I need to mention that my combo box is unbound:

    http://visualbasic.ittoolbox.com/gro...ubform-4263960

    Because it's unbound, the Control Source is blank, correct? Does that answer your question?

  11. #11
    Madmartigan is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    36
    My subform's name is:

    fCustomer_Balances_by_Reason_Year_subform

    So I tried putting:

    Me.fCustomer_Balances_by_Reason_Year_subform.reque ry

    in the after updated event of the combo box and get this error:

    "Microsoft Office Access can't find the object 'Me.'

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Me is an alias reference to form name and only works in VBA. If you put that command directly in the AfterUpdate event property, that won't work. Select [Event Procedure] then click the ellipsis (...) to open the VBA procedure. Type code.
    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.

  13. #13
    Madmartigan is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    36
    Oh. My. [Insert Expletive]. That's all I needed to do this whole time!? It works like a charm!!! I've been fighting this for days!!!! I can't thank you enough for the help and patience. Once again you've saved the day.

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

Similar Threads

  1. Replies: 1
    Last Post: 12-10-2013, 03:15 PM
  2. Replies: 3
    Last Post: 11-26-2013, 03:40 PM
  3. Replies: 1
    Last Post: 09-06-2011, 01:47 PM
  4. Replies: 0
    Last Post: 08-24-2010, 06:38 PM
  5. Replies: 0
    Last Post: 12-16-2009, 01:14 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