Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    Miles R is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Mar 2019
    Posts
    176
    Thanks for this. Yes indeed the revised code does make a difference and the original value is retained.
    Will have to research this a bit more.


    The original syntax is how I normally set values on another form. Maybe it confuses things if it is a subform, and I need to use the Child syntax you provided - was not aware about that.
    Not sure what you mean though that it is not the Current Event, as pressing the button does trigger the Current Event on the subform as the MsgBox popup shows.

  2. #17
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Yes, but pressing a record navigation button also triggers the current event, and the contents of that variable remained.
    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. #18
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Issue was not with event used but code syntax.

    When referencing from another form a form used as subform, must reference through subform container control name.
    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.

  4. #19
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Form_Subform
    That syntax is valid (see the syntax in the project window) and a built in event can be called if it's public. This worked for me if the current event is public:
    Form_Subform.Form_Current

    The OP used that syntax to set subform filter property, then applying it caused the current event to run.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #20
    Miles R is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Mar 2019
    Posts
    176
    Thanks for all the comments. Yes, it seems that as June7 says, reference to a subform must be made through the subform container control name.
    I am wondering if setting the filter property directly rather than through the container is what cases the issue and an untrapped error occurs, which reset the variables, although no error is apparent.

    Anyway, I am now using the correct syntax and have moved the variables back to the subform header and everything is working correctly.

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

Similar Threads

  1. Reset Autonumber in Form
    By Rude Awakening in forum Access
    Replies: 1
    Last Post: 04-20-2020, 04:42 PM
  2. Help with password reset form
    By Coombes1976 in forum Access
    Replies: 5
    Last Post: 11-22-2018, 03:07 PM
  3. Need to reset search form.
    By rebfein in forum Forms
    Replies: 2
    Last Post: 04-19-2017, 09:39 AM
  4. Replies: 2
    Last Post: 11-20-2012, 03:00 PM
  5. Reset imageBox on a form?
    By bosve73 in forum Forms
    Replies: 0
    Last Post: 08-11-2010, 07:16 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