Results 1 to 7 of 7
  1. #1
    d9pierce1 is offline Expert
    Windows 10 Access 2019
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    776

    Getting from a subform to a parent form button_Click

    Hi all,
    See Code Below
    I have a ParentForm and SubForm
    On the sub form I have a button "OpenBalance"

    When I click this button depending on Case Select
    If Case 5 then I want it to Click the LoanCalc button on the parent form.
    I have tried all sorts of stuff and cant get it to compile....



    Code:
    Private Sub CmdOpen_Click()
    
    
    Select Case Forms!frmAccount!CboAccountType
    
    
        Case 1, 2, 3, 4  'Asset, Expense, Income, Liability(ST)
            DoCmd.OpenForm "frmOpenBalance"
        DoCmd.GoToRecord , , acNewRec
        Forms!frmOpenBalance!CboToAccount = Me.AccountID
        Forms!frmOpenBalance!TransAmount.SetFocus
        
        Case 5 'Liability(LT)
        Forms!frmAccount!CmdLoanCalc.SetFocus
       Call Forms.frmAccount.CmdLoanCalc_Click
        End Select
    End Sub
    Thank you all

  2. #2
    davegri's Avatar
    davegri is offline Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,407
    Call Form_frmAccount.CmdLoanCalc_Click

    or perhaps

    Call Me.Parent.cmdLoanCalc_click
    Last edited by davegri; 03-09-2023 at 09:14 AM. Reason: sp

  3. #3
    d9pierce1 is offline Expert
    Windows 10 Access 2019
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    776
    Hi davegri,
    Well neither worked but Call Me.Parent.cmdLoadCalc_click did compile, just gave an error when run
    The other method wouldnt compile
    Thanks


  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    Quote Originally Posted by d9pierce1 View Post
    Hi davegri,
    Well neither worked but Call Me.Parent.cmdLoadCalc_click did compile, just gave an error when run
    The other method wouldnt compile
    Thanks

    Have you walked through the code with F8?
    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

  5. #5
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    Have you switched the CmdLoanCalc_Click from Private to Public? Once you do that try calling it like this:
    Code:
    Call Form_frmAccount.CmdLoanCalc_Click
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  6. #6
    d9pierce1 is offline Expert
    Windows 10 Access 2019
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    776
    Sure, I am getting an application-defined or object-defined error
    run time 2465

  7. #7
    d9pierce1 is offline Expert
    Windows 10 Access 2019
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    776
    Thank you Vlad,
    Worked as smooth as silk
    Dave

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

Similar Threads

  1. Replies: 10
    Last Post: 12-29-2021, 07:53 AM
  2. Replies: 3
    Last Post: 12-06-2018, 03:27 PM
  3. Replies: 2
    Last Post: 07-21-2018, 08:13 AM
  4. Replies: 6
    Last Post: 11-20-2014, 03:37 PM
  5. Replies: 1
    Last Post: 04-08-2013, 11:27 AM

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