Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    sparker75 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jul 2018
    Posts
    107

    Thumbs up VBA Compile Error Method or data member not found

    Hello,



    Im trying to figure an error out and was wondering if anyone can please help./ Thank you in advance.

    Click image for larger version. 

Name:	Capture.JPG 
Views:	9 
Size:	123.8 KB 
ID:	34882

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Does it highlight a line?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    sparker75 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jul 2018
    Posts
    107
    Fixed first error. it was DoCmd.Mazimize. Corrected to DoCmd.Maximize

    New error Run-time error '2467':
    The expression you entered refers to an object that is clised or doesn't exist

    Highlighted this row Set oTgl = oFra.Controls(i + 1) '0 is its label

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Never tried to loop a frame like that. Hit Debug when it errors and see what i is by hovering over it. Make sure it's appropriate to the number of controls in the frame. Can you attach the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    sparker75 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jul 2018
    Posts
    107
    Click image for larger version. 

Name:	IMG_1402.jpg 
Views:	6 
Size:	306.7 KB 
ID:	34883

    I cant share the db

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Hover over i and see what its value is, or in the Immediate window type:

    ?i
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    sparker75 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jul 2018
    Posts
    107
    i = 1 is what it is

  8. #8
    sparker75 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jul 2018
    Posts
    107
    My goal is to create a sort filter for my tabular form

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    So it went successfully through the loop once? Type this in the Immediate window:

    ?Forms!FormName.FrameName.Controls.Count

    replacing the form name and whichever frame this is failing on.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I've used frames for sorting, but never needed to dynamically control it like that.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    sparker75 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jul 2018
    Posts
    107
    Sorry Im new to this. Is this how you want the above added?

    'this Sub Implements sort-buttons in an OptionGroup
    Sub FillButtons(oFrm As Form, oFra As OptionGroup)
    Print Forms!frmOrderStatus.Frame64.Controls.Count
    Dim oRS As DAO.Recordset, i As Integer
    Dim oTB As TextBox, oTgl As ToggleButton
    Set oRS = oFrm.RecordsetClone
    For i = 0 To oRS.Fields.Count - 1
    Set oTB = oFrm.Detail.Controls(i)
    Set oTgl = oFra.Controls(i + 1) '0 is its label
    oTB.ControlSource = oRS.Fields(i).Name
    oTgl.Caption = oRS.Fields(i).Name
    oTgl.Left = oTB.Left
    oTgl.Width = oTB.Width
    oTB.Locked = True 'so no editing here
    Next i
    oFrm.AllowAdditions = False 'so no new records here
    DoCmd.Maximize
    End Sub

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No, I suggested typing it into the Immediate window. I'm trying to see if the frame being worked on has the expected number of controls. I understand you can't post the actual db, but a representative sample would help.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #13
    sparker75 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jul 2018
    Posts
    107
    ?Forms!frmOrderStatus.Frame65.Controls.Count
    2

  14. #14
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    And are there 2 toggle buttons, or 1 plus the label? I think the controls collection is zero based, so when i=1, 1+1=2, and 2 wouldn't be a valid value thus your error. Maybe adding 1 is a mistake?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  15. #15
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I just played around, and an option group that reports 4 as the count throws your error if I do:

    ?reports!rptBreakDownSheet.fraSort.Controls(4).nam e

    so it's definitely zero based.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. compile error Method or data member not found
    By gunterbrink in forum Programming
    Replies: 9
    Last Post: 01-23-2017, 09:45 AM
  2. Replies: 3
    Last Post: 12-24-2016, 12:42 PM
  3. Compile Error: Method or data member not found
    By JustinC in forum Programming
    Replies: 4
    Last Post: 11-18-2014, 10:25 AM
  4. compile error method or data member not found???
    By chuman vishal in forum Programming
    Replies: 2
    Last Post: 02-26-2013, 01:57 PM
  5. Compile Error: Method or data member not found
    By subtilty in forum Programming
    Replies: 5
    Last Post: 02-09-2012, 07:56 AM

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