Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    MadTom's Avatar
    MadTom is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Location
    CT and VT
    Posts
    206
    Ok, after tring many things and viewing many pages! This is what I got to work.



    Code:
    Private Sub Form_Close()
      Forms("frmParts").CheckValue
    End Sub

  2. #17
    MadTom's Avatar
    MadTom is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Location
    CT and VT
    Posts
    206
    Is there another way to write this code?
    Forms("frmParts").CheckValue
    What does Forms! do in the code?

  3. #18
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Forms("frmParts").CheckValue

    should do the same thing as what I posted in post 6, with the new name. I just tested this from a different form and it worked as expected.

    Code:
    Private Sub Command9_Click()
      Forms!Form1.TestFromDifferentForm
    End Sub


    The function in Form1 named:

    Code:
    Public Sub TestFromDifferentForm()
    ...
    End Sub


    ran as expected.


    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #19
    MadTom's Avatar
    MadTom is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Location
    CT and VT
    Posts
    206
    Paul, yes it did run the same! Sorry! Not sure what I did wrong, but now I see there is another way. Is that what the ! does?

    Code:
    Private Sub Form_Close()
        On Error Resume Next
        'Forms("frmParts").CheckValue ' Update CheckValue when frmSearch is closed
        Forms!frmParts.CheckValue
    End Sub
    Thanks for your help!
    Tom

  5. #20
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    In general terms with both methods you're telling Access that what follows is the name of a form, so it will know where to look for the named function. If the function/sub was in a standard module you wouldn't have to include any of that, just the function/sub name. If the code happened to be behind a report rather than a form, it would be Reports! or Reports("...").
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #21
    MadTom's Avatar
    MadTom is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Location
    CT and VT
    Posts
    206
    Thanks! that clears it up.

  7. #22
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Key Press Event and/or Key Up Event not firing as expected
    By GraeagleBill in forum Programming
    Replies: 7
    Last Post: 01-16-2018, 04:11 AM
  2. Replies: 2
    Last Post: 10-09-2016, 05:41 PM
  3. Replies: 7
    Last Post: 05-08-2014, 10:34 AM
  4. Replies: 1
    Last Post: 03-29-2014, 07:46 PM
  5. Replies: 3
    Last Post: 05-07-2012, 12:17 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