OnLayoutEnter and variable problem

Version 1

    Dears.

     

     

    i need some help ,and may i get the answers for my important questions please.

    i did a program and i finished it, in my program there is a different access for every employee, and my problem in this issue.

     

    i know there is an access page control in the filemaker, but i have created my own techniques for accessing layouts for user employees.

     

     

    i know that this command

     

    set variable[ $$USER_NAME_ ACCESS , GET(UserAccount) ]

    gets the user's account name then directs it to that global variable (( $$USER_NAME_ ACCESS ))

    and in the layout home page, i print the value of this global variable as shown in the picture below. Screen Shot 2016-12-13 at 9.35.27 AM - Copy.png

     

     

    and it's work fine and the results as shown.

    003.png

     

     

    the problem is that sometimes in the layout's home page when the user logs in  (( $$USER_NAME_ACCESS )) the global variable prints empty value like as shown below

    004.png.

     

     

    The home page layout is the first layout open after I enter my user name and password,

    in the OnLayoutEnter I wrote my code, and this picture for more clarification.

     

    Log in step

     

     

     

     

     

    And this is the home page cods.

     

    Screen Shot 2016-12-13 at 9.35.27 AM - Copy (2).png

     

     

    i dont know if that is a programmatically mistake or it’s a bug.

     

     

    Regards.

     

     

    Eng. Khalid Othman.