Form error code 2465

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • imrosie
    New Member
    • May 2007
    • 222

    #1

    Form error code 2465

    Hello all,
    Yes, another newbie...HELP please.
    I have a problem compiling a procedure on a form. The 'search customer' form was built on a query. The proc is attached to command button which opens up another form (Orders). At first I got the error 2450 (can't find form). After trying to compile (or recompile and save), it began recognizing the form,,,, then it started giving me 2465, can't find the fields.So after reading some other similar forums, I changed the field names to the actual field names on the forms (both) because prior, I had the field names (i.e., [fullname] and [fullcustname]) as the REAl field names as listed in the tables(query) which were [CustomerName] and [CustomerName]......

    Now it's gone back to 2450, can't find the table...Does anyone have a suggestion? Both forms are built on a separate query...Is that the problem?

    thanks in advance
    Rosie

    Private Sub beginanorder_Cl ick()
    'The event to open the Order form with some controls filled in
    Forms![Add an Order and Details]![thefullname].Value = Forms![Search Customer Record]![fullcustname]
    Forms![Add an Order and Details]![TheCompany].Value = Forms![Search Customer Record]![acompanyname]
    Forms![Add an Order and Details]![acustid].Value = Forms![Search Customer Record]![accountnum]
    DoCmd.Close acForm, "Search Customer Record", acSaveNo
    End Sub
  • MSeda
    Recognized Expert New Member
    • Sep 2006
    • 159

    #2
    the code you posted doesn't actually contain a command to open the order form, is that form already open?
    can you post the previous version of the code you mentioned when you got the 'can't find fields' error?

    Comment

    • imrosie
      New Member
      • May 2007
      • 222

      #3
      Originally posted by MSeda
      the code you posted doesn't actually contain a command to open the order form, is that form already open?
      can you post the previous version of the code you mentioned when you got the 'can't find fields' error?
      Hello and thanks up front for your inquiry,

      No the form (Orders) isn't already opened. The button (cmd) on the 'Search' form is suppossed to open the Orders form complete with most of the controls information passed to it, so there's no retyping. the Button is called

      'BeginOrder' and here's the original code:

      Private Sub beginanorder_Cl ick()
      'The event to open the Order form with some controls filled in
      Forms![Add an Order and Details]!Customers.[CustomerID].Value = Forms![Search Customer Record]![CustomerID]
      Forms![Add an Order and Details]![CompanyName].Value = Forms![Search Customer Record]![CompanyName]
      Forms![Add an Order and Details]![FullName].Value = Forms![Search Customer Record]![FullName]

      DoCmd.Close acForm, "Search Customer Record", acSaveNo
      End Sub

      The difference is that I simply changed the code on first line of Forms! from ---- to:

      Forms![Add an Order and Details]![fullname].Value = Forms![Search Customer Record]![fullname]

      Note: fullname results from a row query which is: SELECT Customers.Custo merID, [FirstName] & ", " & [LastName] FROM Customers ORDER BY [FirstName] & "," & [LastName];

      Also 'thefullname' is also a row query on the 'Orders' form too. thanks

      so the code looks like this:
      Forms![Add and Order and Details]![thefullname].Value = Forms![Search Customer Record]![fullcustname]
      Forms![Add an Order and Details]![TheCompany].Value = Forms![Search Customer Record]![acompanyname]
      Forms![Add an Order and Details]![acustid].Value = Forms![Search Customer Record]![accountnum]

      DoCmd.Close acForm, "Search Customer Record", acSaveNo
      End Sub

      Any ideas? thanks

      Comment

      • MSeda
        Recognized Expert New Member
        • Sep 2006
        • 159

        #4
        Add
        Code:
         
        docmd.openform "Add and Order and Details"
        before the first line of code. I'm not sure why you've gotten two different error messages but you need to open the form before passing the values.

        Comment

        • imrosie
          New Member
          • May 2007
          • 222

          #5
          Originally posted by MSeda
          Add
          Code:
           
          docmd.openform "Add and Order and Details"
          before the first line of code. I'm not sure why you've gotten two different error messages but you need to open the form before passing the values.
          That fixed it MSeda,,,,,I don't know why I didn't add that line..thanks so much.

          Rosie

          Comment

          Working...