Results 1 to 6 of 6
  1. #1
    Jims Chan is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Mar 2016
    Location
    Malaysia
    Posts
    10

    Run time error 2465 on search form

    I have a search form to search some records. Search results sometimes will need to update field in subform. But when executing there happens to be a Runtime Error 2465 saying that it cant find the field 'Quotes2Sub'(subform name).
    PrivateSub Select_click()
    Dim strMF asString
    Dim strSF asString

    strMF
    =[mainform]

    if subform=""then
    forms
    (strMF).ClientID=ClientID
    else
    strSF
    =[Subform]
    Forms
    (strMF).Controls(strSF).form.ClientID=ClientID
    EndIf
    EndSubRun time error states that the error is on


    Forms(strMF).Controls(strSF).form.ClientID=ClientI D
    With same code above using in another search form, it has worked without error...

  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Is subform a variable? If subform = "" surely suggests it is but it's not declared


    Sent from my iPhone using Tapatalk

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    Forms(strMF).Controls(strSF).form.ClientID=ClientID

    Do you really have a subform control with the same name as the form on which it is located?

  4. #4
    Jims Chan is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Mar 2016
    Location
    Malaysia
    Posts
    10
    how to say subform is a variable?

  5. #5
    Jims Chan is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Mar 2016
    Location
    Malaysia
    Posts
    10
    yes, subform do have the control with same name
    Quote Originally Posted by Ajax View Post
    Forms(strMF).Controls(strSF).form.ClientID=ClientID

    Do you really have a subform control with the same name as the form on which it is located?

  6. #6
    Jims Chan is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Mar 2016
    Location
    Malaysia
    Posts
    10
    Dear all expert,

    I have solve the problem.... i deleted the subform in design mode, through the design ribbon add subform and choose again the subform into the mainform...
    its works!!!! thanks a lot

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

Similar Threads

  1. Replies: 13
    Last Post: 10-25-2012, 06:15 PM
  2. run time error 2465
    By karma in forum Access
    Replies: 3
    Last Post: 08-09-2012, 04:08 AM
  3. Run Time Error 2465
    By jo8701 in forum Programming
    Replies: 1
    Last Post: 02-08-2012, 12:01 PM
  4. Run Time Error 2465 In Report
    By desk4tbc in forum Programming
    Replies: 9
    Last Post: 09-06-2011, 08:00 PM
  5. Run-Time error '2465'
    By hawkins in forum Access
    Replies: 6
    Last Post: 08-19-2011, 04:07 PM

Tags for this Thread

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