Results 1 to 6 of 6
  1. #1
    terjeo is offline Novice
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    11

    Show a button in FormA based on an TXT_field in FormB

    Hello all helpers.
    I am trying to learn VBA.

    I have two forms, one FormA and one FormB.
    In FormA I have a button "Other_info"


    In FormB I have a txt_field "Other Info".

    When something is written in the txt_field in FormB, I want the button "Other_info" to be visible in FormA. Els not.

    This is my code:

    If Len(Me.[Other Info].Value & "") > 0 Then
    Forms!FormA!Other_Info.Visible = True
    'Else
    'Forms!FormA!Other_Info.Visible = False

    'End If

    This do not work.
    I get a message that the system do not find "FormA"

    I am grateful for any tip.

  2. #2
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    Both FormA and FormB must be open when txt_field is evaluated in FormB.
    Last edited by davegri; 03-23-2024 at 12:39 PM. Reason: correction

  3. #3
    terjeo is offline Novice
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    11
    davegri

    I do not understand this.

    When I write in the Text field in FormB, must the FormA be open?

    Sorry for my stupidity

  4. #4
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    When I write in the Text field in FormB, must the FormA be open?
    Yes. FormB cannot find FormA unless it is open. This is exactly what is triggering your error message.
    Last edited by davegri; 03-23-2024 at 02:58 PM. Reason: additional

  5. #5
    terjeo is offline Novice
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    11
    Quote Originally Posted by davegri View Post
    Yes. FormB cannot find FormA unless it is open. This is exactly what is triggering your error message.
    Ok, so I can not use this metod, but thanks anyway, I have learned some more

  6. #6
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    Quote Originally Posted by terjeo View Post
    Ok, so I can not use this metod, but thanks anyway, I have learned some more
    Perhaps there are workarounds. You can store the value of txt_field in a Tempvar whenever it is updated.
    Then, whenever FormA is opened at a later time, it can look at the Tempvar for a value.
    This will only work for the current session, as the values of Tempvars are not retained after shutdown.

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

Similar Threads

  1. Replies: 5
    Last Post: 08-27-2018, 08:58 AM
  2. Button that will show certain fields on form
    By banpreet in forum Programming
    Replies: 2
    Last Post: 04-21-2017, 07:57 PM
  3. Show button on print
    By ghodgkins in forum Reports
    Replies: 4
    Last Post: 08-18-2015, 01:28 PM
  4. Replies: 3
    Last Post: 01-20-2014, 04:55 PM
  5. Replies: 1
    Last Post: 06-12-2011, 07:08 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