Results 1 to 7 of 7
  1. #1
    Synergy.ron@gmail.com is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2020
    Location
    washington
    Posts
    126

    Question form onload event when calling standard module sub generates err

    i have a standard module named main. it has a public sub named verifyserial(). when I run verifyserial() from debug it works. but if i reference verifyserial from the form onload event i get:
    Views: Size: ">Attachment 44947


    Attachment 44950

    Attachment 44951
    here is the property reference: It nseems like i have a syntax problem but I pasted the verifyserial name into the event and still get the error. What am I missing? Can this be done?
    Last edited by Synergy.ron@gmail.com; 04-09-2021 at 01:44 PM. Reason: name changed to verifyserial did not help???

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    remove it from ONLOAD then click the elipsis btn in there.
    INSIDE the event code block put VerifySerial like:

    Code:
    sub Form_Load()
    verifyserial
    end sub


    the only thing you can put in an event box is a MACRO NAME.

  3. #3
    Synergy.ron@gmail.com is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2020
    Location
    washington
    Posts
    126
    yes that works. but, aren't you creating a class module? Is it possible to call a standard module sub() without creating a class module???

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Only via a named macro using RunCode but you need to change it to a public function as you cannot call public subs.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #5
    Synergy.ron@gmail.com is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2020
    Location
    washington
    Posts
    126
    I am confused. I thought the idea behind public subs is that you can access them from anywhere. thanks

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    This should help:

    http://www.baldyweb.com/SubFunction.htm

    specifically "You can not call a user-created sub from the Form's event property dialog, only a function"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Calling a module into a form
    By CraigR in forum Modules
    Replies: 3
    Last Post: 12-12-2018, 08:04 PM
  2. Combo box Dropdown method on form's OnLoad event
    By MishaLjusha in forum Forms
    Replies: 1
    Last Post: 03-23-2017, 03:57 AM
  3. Replies: 2
    Last Post: 07-05-2015, 09:10 AM
  4. Replies: 3
    Last Post: 12-22-2014, 11:57 AM
  5. Calling A Module Function To Open A Form
    By orcinus in forum Modules
    Replies: 3
    Last Post: 09-29-2010, 04:43 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