Results 1 to 4 of 4
  1. #1
    Rgaming is offline Novice
    Windows 10 Access 2007
    Join Date
    Oct 2017
    Posts
    9

    Call a button click from another form

    I need code that opens a form called "Add payments". and clicks on a button called "Add_new_Payment" then closes the form.

    I tried this but it doesn't work, it comes up with a syntax error




    Private Sub Command51_Click()
    Call Forms."Add_Payment".Add New Customer_Click
    End Sub

    Any help appreciated

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you consudered putting your OnClick code in a Standard Module so it can be called from both the "Add payments" Form and where you are currently?

  3. #3
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    What are you trying to do with what you listed above? Instead of opening a Add_Payment subform, can you just add the payment from the main form if no data entry is required? Maybe give more description and steps in your process so we can understand more what you are trying to do.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    Duplicate thread? https://www.accessforums.net/showthread.php?t=68617

    Or at least a continuation of same issue. Calling a procedure is useless when the code is non-functional to begin with.

    The name of your button is "Add New Customer" - with spaces? VBA will substitute with underscores in the procedure declaration. Try:

    Call Forms("Add_Payment").Add_New_Customer_Click

    Advise not to use spaces nor punctuation/special characters (underscore only exception) in any names.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Call Click event in nagivation button from subform
    By Malalex in forum Programming
    Replies: 2
    Last Post: 02-05-2017, 06:33 PM
  2. External script to call Command Button Click event handler
    By Sean Nakasone in forum Programming
    Replies: 5
    Last Post: 10-29-2014, 12:35 PM
  3. Click to call and TempVariable
    By Seito in forum Programming
    Replies: 5
    Last Post: 11-07-2011, 02:42 PM
  4. Call a button on the main form from the subform
    By Grooz13 in forum Programming
    Replies: 1
    Last Post: 09-28-2011, 01:15 PM
  5. Form command button to do something/call function
    By shubhamgandhi in forum Programming
    Replies: 2
    Last Post: 07-27-2011, 04:45 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