Results 1 to 2 of 2
  1. #1
    swenger is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2016
    Posts
    151

    Displaying a Public Variable on a form

    I declared a public variable which is recorded based on what they choose on one form. When that form is closed and another form is open I would like to display the value of this Variable. My variable is called UnLong. I tried creating a Text Box and typing =[UnLong] but it displays #Name?

    what is the correct way?



    Thanks
    Sam

  2. #2
    swenger is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2016
    Posts
    151
    So it seems like I need to do this through a Funtion.

    I declared this

    Public Function LoggedInAs() As String
    LoggedInAs = unLong
    End Function

    On my form the control for the text box is =LoggedInAs()

    This works.

    However, if this form is opened and then the unLong variable changes through another action on a different form, this text box doesn't update unless I close and re-open the form.

    Is there a way to have this text box refresh when the variable is updated.

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

Similar Threads

  1. Replies: 5
    Last Post: 04-27-2015, 02:40 PM
  2. Public variable not updating for each function
    By Ruegen in forum Programming
    Replies: 3
    Last Post: 08-28-2014, 06:26 PM
  3. Replies: 1
    Last Post: 08-03-2014, 07:48 PM
  4. How to use global/public variable
    By mrbabji in forum Programming
    Replies: 7
    Last Post: 05-18-2013, 10:08 PM
  5. Replies: 1
    Last Post: 03-28-2013, 07:54 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