Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    Evansville, Indiana, USA
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    error 2450 (2007)

    I have the following procedure in a form:

    Private Sub btnOK_Click()
    If IsNull(cmbPartner) Then
    MsgBox "Please select a name from the box.", vbInformation
    Else
    [Forms]![frmentrysub]![txtPartner] = "test"
    DoCmd.Close
    End If
    End Sub

    I get a runtime error when it tries to execute line [Forms]![frmentrysub]![txtPartner] = "test". Am I doing something wrong? It also says that the database can't find the form frmentrysub. The form does exist and is open. I have double checked the spelling also. The form is a subform on a form that is already open when this procedure runs.

    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: error 2450 (2007)

    A subform is not part of the Forms collection. If you want to refer to a subform control, you must use the syntax

    Forms![NameOfMainForm]![NameOfSubform]![NameOfControl]

    You should use the name of the subform as a control on the main form. This is not necessarily the name of the subform in the database window. If you open the main form in design view and click once on the subform, you'll see its control name in the Properties window and in the toolbar.

  3. #3
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    Evansville, Indiana, USA
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: error 2450 (2007)

    Thanks, it now works.

Posting Permissions

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