Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2010
    Posts
    1

    Red face Unanswered: Unable to call a macro stored in subform from mainform

    Hi, following is my requirement and the problem that I'm facing

    Requirement -
    Main form - shows all search criteria - text boxes and search button
    Subform - shows all the filtered results from Mainform + a button for each row.
    Detail Form - a pop up form which needs to be opened when I click on the button on the subform.

    Problem - If i directly open the subform and click on the button for one of the rows, i'm able to open the Detail form - with the following code stored in the subform -

    "Private Sub USL_SEARCH_BUTTON_Click()

    Dim BILLER_ID As String
    BILLER_ID = Forms!MASK_ADDRESS_USL_QUERY_FORM.BILLER_ID
    DoCmd.OpenForm "USL_SEARCH_FORM", acFormDS, , "BILLER_ID=Forms!MASK_ADDRESS_USL_QUERY_FORM.BILLE R_ID", acFormReadOnly

    End Sub
    "

    But when I try to click the button from the main form (which has the subform form embedded, it shows the following error-
    "Run-time error '2450':
    Microsoft Access can't find the form
    'MASK_ADDRESS_USL_QUERY_FORM' referred to in a macro expression or Visual Basic code.
    "


    Can any please help me out.
    Regards,
    Manu

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    The syntax to refer to the form when it's a subform is different:

    Forms: Refer to Form and Subform properties and controls
    Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •