Results 1 to 10 of 10
  1. #1
    secretary is offline Novice
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Posts
    29

    run-time error '2450' microsoft office access can't find the form


    I've written the following procedure for my form:

    Code:
    Private Sub PrintFamily()
        Dim strLastName1$
        Dim strLastName2$
        Dim strFamily$
        strLastName1 = Forms![Member Entry Form]!txtLastName1
        strLastName2 = Forms![Member Entry Form]!txtLastName2
        strFamily = strLastName1
        If strLastName1 <> strLastName2 Then
            strFamily = strLastName1 & "/" & strLastName2
        End If
        Me.txtFamily = strFamily
    End Sub
    But then I get the following error:

    run-time error '2450' microsoft office access can't find the form referred to in a macro expression or Visual Basic Code
    What's the issue?

  2. #2
    vicrauch is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Location
    Sacramento
    Posts
    27
    There are only two lines in this module where a form is referenced, so the issue is with those two lines. The form mentioned here "Member Entry Form" must be open for Access to "see" it. I will assume the form is not open when you run this procedure. Or else, you have the name misspelled here. Check for spaces, could be two spaces in the name of the actual form, or maybe no spaces in the actual form name.
    I would like to suggest, in the future, leave the spaces out of any object or variable name. Saves having to type those brackets, and it is just as easy to read:
    Member Entry Form or MemberEntryForm

  3. #3
    secretary is offline Novice
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Posts
    29
    The unopened form was the issue.
    I however, decided not to use the form as a source, but tables instead:

    Code:
    Private Sub PrintFamily()
        Dim strLastName1$
        Dim strLastName2$
        Dim strFamily$
        strLastName1 = FirstMember.FirstName
        strLastName2 = SecondMember.FirstName
        strFamily = strLastName1
        If strLastName1 <> strLastName2 Then
            strFamily = strLastName1 & "/" & strLastName2
        End If
        Me.txtFamily = strFamily
    End Sub
    Yet now I get the following error:

    run-time error '2465' microsoft access can't find the field '|' referred to in your expression
    Incidentally, I took your advice and renamed all my objects without spaces.

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You can't reference a table that way. You can either use DLookup():

    DLookup Usage Samples

    or open a recordset on the table.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    vicrauch is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Location
    Sacramento
    Posts
    27
    Thanks Paul. I was wondering where FirstMember and SecondMember came from.
    BTW did you see my question in the Programming forum about how to iterate through a custom Collection? I was thinking you might be able to help. Thanks!

  6. #6
    vicrauch is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Location
    Sacramento
    Posts
    27
    Secretary,
    You said, "Incidentally, I took your advice and renamed all my objects without spaces." I think you will really enjoy this change.

  7. #7
    secretary is offline Novice
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Posts
    29
    DLookup solves it!
    Thanks!

  8. #8
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    We were happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    uronmapu is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2012
    Posts
    124
    I have this problem too,

    My Code:

    Private Sub Form_Open(Cancel As Integer)

    'Me.ID.Value = Forms!Menu!lstItems.Column(0)
    'txtid.Caption = lstItems.Column(0)
    Me.Title.Value = Forms!Menu!lstItems.Column(1)
    Me.Full_Name.Value = Forms!Menu!lstItems.Column(2)
    Me.Mobile.Value = Forms!Menu!lstItems.Column(3)
    Me.Email_Company.Value = Forms!Menu!lstItems.Column(4)
    Me.Email_Personal.Value = Forms!Menu!lstItems.Column(5)
    Me.Company_Name.Value = Forms!Menu!lstItems.Column(6)
    Me.Home_Address.Value = Forms!Menu!lstItems.Column(7)
    Me.Company_Address.Value = Forms!Menu!lstItems.Column(8)
    Me.Position.Value = Forms!Menu!lstItems.Column(9)
    Me.Data_Source.Value = Forms!Menu!lstItems.Column(10)
    Me.Remarks.Value = Forms!Menu!lstItems.Column(11)
    Me.Telephone.Value = Forms!Menu!lstItems.Column(12)
    Me.Fax.Value = Forms!Menu!lstItems.Column(13)
    Me.Country.Value = Forms!Menu!lstItems.Column(14)
    Me.Birthday.Value = Forms!Menu!lstItems.Column(15)
    Me.Category.Value = Forms!Menu!lstItems.Column(16)
    Me.Web_Page.Value = Forms!Menu!lstItems.Column(17)

    End Sub

  10. #10
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Is the form open?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 9
    Last Post: 11-22-2011, 05:23 PM
  2. Replies: 1
    Last Post: 06-07-2011, 09:10 PM
  3. Replies: 6
    Last Post: 10-30-2010, 08:42 AM
  4. Replies: 0
    Last Post: 10-13-2010, 03:28 PM
  5. Replies: 1
    Last Post: 03-02-2010, 03:01 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