Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664

    The method is not found.

    The two attached files show a bug in program Division_Dashboard4.



    The program on the form_open function saying the method is not found.

    he sub program is immediately above the form_open sub. Yet it says it is not found!


    Please tell me how to fix this bug.

    Respectfully,

    Lou Reed
    Attached Thumbnails Attached Thumbnails 2017-03-22_13-22-02.png  
    Attached Files Attached Files

  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
    The name of the button is

    cmdSend_Email

    not

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

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    looks like you are referring to a click event of the cmdSend_email control. Remove the '_click' part

  4. #4
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Okay, I believe that is the error. But for my information what is the "_click" part called?

    Thanks in advance.

    Respectfully,

    Lou Reed

  5. #5
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    It's the same type of error you were getting before. The syntax of the code tells access that you are attempting to set the Enabled property of a control called cmdSend_EMail_Click. It cannot find a control called that, so it looks to see if cmdSend_EMail_Click is a method associated with the form. It isn't that either, so Access gives up and issues an error message.

    The sub program is immediately above the form_open sub.
    There is A sub called cmdSend_Email_Click there, yes. But this code : Me.cmdSend_Email_Click.Enabled = False

    is not referencing that subroutine.

    The sub cmdSend_Email_Click is code in the On Click event of the form control called cmdSend_Email.

    To enable/disable the command button, use : Me.cmdSend_Email.Enabled = False
    You enable or disable the command button, not its code.

  6. #6
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Okay, is it the same here? I have attached a Snagit pic of the error?

    Any help appreciated.

    Respectfully,


    Lou Reed
    Attached Thumbnails Attached Thumbnails 2017-03-22_15-01-00.png  

  7. #7
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    what error message are you getting? that should tell you want the problem is. My guess would be you either don't have a control called 'chkMeeting_invite_Sent' or it does not have Boolean type control source

  8. #8
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    No, that one is because chkMeeting_Invite_Sent is a label, and you cannot set a value to a label. That said, the one you want is chkMeeting_Invite_Sent_ (with an underscore at the end) of the name: If Me.chkMeeting_Invite_Sent_ = True Then .

    BTW, that is a TERRIBLE control naming convention! (My opinion, of course)

  9. #9
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    John_G:

    I am interested in others opinions. I see the error that you pointed out. But how can I improve on my control naming?

    Respectfully,

    Lou Reed

  10. #10
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    But how can I improve on my control naming?
    Lou - do you really need an answer to that? You claim to be an expert in your tag and in previous posts you have mentioned you are well versed in other languages. Do other languages allow spaces and other non alpha numeric characters? There is much discussion online about naming conventions - google to find out more. At the end of the day it is down to personal preference and being consistent.

    I see you often pick up bits of code from all over the place. Each author has their own convention. So when you pick up these snippets, the first thing you should do before applying to your application is to change all the names to meet your convention. This may also mean laying to code out in a consistent way as well.

    So to answer your question - you need to develop a convention that suits you. We can't tell you what that is. For me, I allow no spaces, underscores or other non alphanumeric characters, have a prefix to indicate the type (cbo=combo, btn=button, pub for public etc). I have a consistency in naming to describe the object/variable and what it does. I also keep it short so I have certain standard abbreviations I use - e.g. cust rather than customer and I use uppercase to separate the names e.g. btnCustsList, lstCusts. It doesn't always work, there are exceptions, but it works for me.

  11. #11
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Code:
    what error message are you getting? that should tell you want the problem is. My guess would be you either don't have a control called 'chkMeeting_invite_Sent' or it does not have Boolean type control source
    I am not sure what you mean here. I have a Sub with that name as far as I can see.

    Respectfully,

    Lou Reed

  12. #12
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    when the code stops with an error, an error message box pops up and tell you what the error is. When you click on the debug button the vba window highlights the line in yellow per your post. This happens whether you are running the code as in clicking a button or opening a form whatever or compiling from the vba window. Note that compiling only picks up things like missing references etc, whilst running the code will pick up additional errors such as a value is null (and not managed) or assigned a wrong datatype and cannot be processed.

  13. #13
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Code:
    So to answer your question - you need to develop a convention that suits you. We can't tell you what that is. For me, I allow no spaces, underscores or other non alphanumeric characters, have a prefix to indicate the type (cbo=combo, btn=button, pub for public etc). I have a consistency in naming to describe the object/variable and what it does. I also keep it short so I have certain standard abbreviations I use - e.g. cust rather than customer and I use uppercase to separate the names e.g. btnCustsList, lstCusts. It doesn't always work, there are exceptions, but it works for me.
    Of course, one must develop their own style no argument. I have programmed in many other languages, but nothing ever like this. It seems to have a twist, turn or wrinkle every time you turn around.

    Please do not think that I am being critical, it is just every time (or most of the time) I get stuck on a error - something new pops out.

    Again, please do not think I am being critical. It helps in any language if you keep working on it all the time. I do not. Also, when I see an error that I should know, it is usually because I have not worked in that area of MS Access for a for several months.

    Learning MS Access 2010 is not like learning to ride a bicycle - once you learn it you never forget it. I find if I do not use it often, then I will lose it.

    The best analogy I can think of is playing sports game when we were kids, when one of the players starts making new rules up on the spot. Yes, we tolerated this.
    Somehow a simple game becomes complicated, it seems every time you turn around he is adding a new rule. That c or Pascal or even Fortran programming was never like this.

    When I program in those languages my number one concern is making sure that I translate the algorithm correctly into code. If I fall down on the syntax, then I can also
    figure it out.

    In programming in MS Access my whole concern is syntax. The overall algorithm is secondary. Did I get the coding correct is my overall concern nothing else.

    Again,, please do not think I am being critical - I am not.

    It just seems that everything in MS Access VBA is so different.

    I volunteered for this project, based on the fact that I did some VBA programming in Excel a few years back. It took one afternoon to learn that - just one afternoon.

    This is very situational and particular.

    It is a lot different that what I am use to.

    Well, there you have it.

    Hope I did not step on any toes as it was not my intention.


    Respectfully,

    Lou Reed

  14. #14
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Code:
    No, that one is because chkMeeting_Invite_Sent is a label, and you cannot set a value to a label.  That said, the one you want is chkMeeting_Invite_Sent_ (with an underscore at the end) of the name:  If Me.chkMeeting_Invite_Sent_ = True Then .
    I see your point. I think it is best to change chkMeeting_Invite_Sent_, to chkMeeting_Invite_Sent.

    How can that be done?

    Respectfully,

    Lou Reed

  15. #15
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    To change the name of a control, click the "All" tab of its properties sheet; the first one at the top (you might have to scroll up) is "Name" - change it to the name you want.

    In your case, you need to change the name of the label first (I'd suggest lblMeeting_Invite_Sent), then change the name of the checkbox (to remove the trailing underscore)

    There is one huge caveat when renaming controls. You have ensure that all lines of code (and sometimes queries) that reference the renamed control are changed accordingly, otherwise you will get compilation errors.

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

Similar Threads

  1. Method or data member not found
    By annmv888 in forum Access
    Replies: 1
    Last Post: 12-17-2016, 08:36 PM
  2. Me.DOExp - Method or data member not found
    By GraeagleBill in forum Forms
    Replies: 4
    Last Post: 02-12-2016, 07:16 PM
  3. Method or data member not found
    By hendrikbez in forum Access
    Replies: 2
    Last Post: 11-21-2014, 10:52 AM
  4. Method or Data Member not found
    By johnnyBQue in forum Programming
    Replies: 4
    Last Post: 11-03-2014, 07:15 AM
  5. Method or data member not found
    By papa yaw in forum Programming
    Replies: 5
    Last Post: 12-17-2012, 02:19 PM

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