Results 1 to 3 of 3
  1. #1
    bonecone is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    25

    Question Call a subform event from the main form

    I use the onLoad event of the parent form to select the first item in a combobox of a subform. If I use the syntax



    Form_frmSubformName.cboControlName.ListIndex = 0

    I get an error message about the improper use of the ListIndex property. If I use the syntax

    Form_frmSearch.cboField = Form_frmSearch.cboField.ItemData(0)

    it selects the first item in the list but it fails to trigger the onChange event of the combobox. I know how to manually call an event of a control within the same form, but how do you call the control event of a subform?

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Try:
    Me.SubFormName.Form.CtrlName_Change
    Change the names in Red

    Also change the declaration of the subform control from Private to Public
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    bonecone is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    25
    Ok thanks! That worked.

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

Similar Threads

  1. Replies: 3
    Last Post: 04-17-2012, 10:28 AM
  2. How to call After update event to the textbox
    By pwalter83 in forum Forms
    Replies: 1
    Last Post: 12-20-2011, 11:16 AM
  3. Call a button on the main form from the subform
    By Grooz13 in forum Programming
    Replies: 1
    Last Post: 09-28-2011, 01:15 PM
  4. Replies: 5
    Last Post: 02-08-2011, 11:17 AM
  5. Replies: 2
    Last Post: 11-30-2010, 10:06 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