Results 1 to 4 of 4
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919

    General module calling public function in an open form

    The xfrMoveDon function below gets control via a right-click command bar ("RC14Don") from an OPEN form "frmDonFamEntry" that contains a public function "MoveDon" in its module.


    Code:
    Public Function xfrMoveDon(Dummy As Integer)
    Forms!frmDonFamEntry.Form.MoveDon (0)
    End Function
    When the command bar fires, I get a 2465 error raised and can't figure out why?
    Click image for larger version. 

Name:	000.jpg 
Views:	13 
Size:	23.5 KB 
ID:	48839

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    Didn't you try this a few months back?

    This one was the one I was thinking of? https://www.accessforums.net/showthr...ht=public+form
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    if the function is in the master form (no subforms) then form not needed:
    Forms!frmDonFamEntry.MoveDon (0)




    if its in a sub form of the master form:
    Forms!frmDonFamEntry.subform.form.MoveDon (0)

  4. #4
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Yes, I had completely forgotten the syntax of the "Call" and used the wrong syntax to call the function.

    Code:
    Public Function xfrMoveDon(dummy As Integer)
    'Forms!frmDonFamEntry.Form.MoveDon (0)
    Call Forms("frmDonFamEntry").MoveDon(0)
    End Function
    The above code got the job done nicely.

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

Similar Threads

  1. Public Function problem on form open
    By d9pierce1 in forum Forms
    Replies: 1
    Last Post: 11-27-2018, 11:19 PM
  2. Replies: 5
    Last Post: 11-25-2017, 03:45 AM
  3. Replies: 3
    Last Post: 06-24-2015, 06:25 PM
  4. Replies: 5
    Last Post: 05-19-2015, 08:41 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

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