Cannot remove error using Nz function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jerry Maiapu
    Contributor
    • Feb 2010
    • 259

    Cannot remove error using Nz function

    Hi there,
    I have a log in form that users use to log in to the ACCESS DB.
    The username and password are taken from the current logged in user of the windows.

    I have put the following as the default value for the
    username text box which works fine.
    ( Takes the current logged in user and punches it into txtusername)

    Code:
    =Environ("UserName")
    However, recently for some Workstations the following showed up in the username text box.
    Code:
     #Name?
    ie the default value

    Code:
    =Environ("UserName")
    errors out..

    How can I solve this? I have tried to put some other text to fabricate the error but its persistent.

    Code:
    =IIf(IsNull(Environ("UserName")),"Enter Username",Environ("UserName"))
    Code:
    =Nz(Environ("UserName"),"Enter UserName")
    Can someone help on this..

    Thanks

    Jerry
Working...