Results 1 to 6 of 6
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919

    Confusing compile error

    The snippet of code pictured below is the OnClick event for a command button. I want to add an optional argument to the event sub so I can call the sub from elsewhere in the module and pass it a parameter. I don't know why I get the error.

    Click image for larger version. 

Name:	000.jpg 
Views:	22 
Size:	123.9 KB 
ID:	25255



    (Works fine without the added argument expression.)

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    Do you have 2 of that same procedure?

  3. #3
    nrgins's Avatar
    nrgins is offline some guy
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    62
    You're trying to modify an Access event procedure with an additional parameter. You can't do that.

    If you want to do a custom function, then create a custom function in the form's code module, and call it from the On Click event, as well as from other places, as you said, instead.

  4. #4
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    That's exactly what I was going try next. I'll do that Sunday AM.
    Bill

  5. #5
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    You can't do that.
    Apparently you are correct. To resolve, I isolated the functional code to separate Function and invoked that function from the OnClick event with the command button, passing the parameter appropriate to that use. That same new Function can also be invoked as a choice in a right-click popup with the parameter passed appropriate to that path of use.

    Thanks,
    Bill

  6. #6
    nrgins's Avatar
    nrgins is offline some guy
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    62
    Apparently you are correct.
    Apparently so! LOL

    Glad you got it worked out.

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

Similar Threads

  1. Confusing runtime error 424 Object needed
    By RichardAnderson in forum Forms
    Replies: 3
    Last Post: 10-18-2013, 02:32 PM
  2. Replies: 2
    Last Post: 06-23-2012, 11:59 PM
  3. Replies: 7
    Last Post: 06-08-2012, 09:55 PM
  4. Replies: 6
    Last Post: 09-28-2011, 09:20 PM
  5. confusing datatype error issue
    By TheShabz in forum Queries
    Replies: 5
    Last Post: 10-11-2010, 05:14 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