Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2012
    Posts
    7

    Unanswered: Mimicking Northwind Login behaviour

    Hello again guys,

    As the title says I am trying to recreate the Northwind 2007 login behaviour in a database I am creating. I have made some strides, but something is missing.

    The behaviour I am looking for is this. When you select your user name from the Login form dropdown list. That username is automatically inserted into whatever form that is opened subsequently. So far I have the login form working ok (I think). However, I can't get that username to automatically be inserted into forms that I open later.

    Thanks a billion for the help.

    Update:
    I've come to realise there is another form "Employee Details" that I didn't notice before. This extra level makes it a bit more complicated for me to understand. I will try to make sense of it, but any help will still be appreciated.
    Last edited by rsindustry; 06-06-12 at 16:06.

  2. #2
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    994
    Provided Answers: 2
    Global variable?
    Hidden form that's open all the time in the background to hold the current user's name?
    10% of magic is knowing something that no-one else does. The rest is misdirection.

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    why store it
    why not use the network logon, which can be retrieved using API calls
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    I agree with healdem, there is no need to store the value.

    Note: You don't even need an API call:
    Code:
    Dim strUserName as String
    strUserName = Environ("USERNAME")
    This works for Windows 2000, Windows XP and Windows 7. Not tested with NT 4 and Windows 8.
    Have a nice day!

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by Sinndho View Post
    I agree with healdem, there is no need to store the value.

    Note: You don't even need an API call:
    Code:
    Dim strUserName as String
    strUserName = Environ("USERNAME")
    This works for Windows 2000, Windows XP and Windows 7. Not tested with NT 4 and Windows 8.
    that is assuming of course you can trust 'Environ', having seen it collapse spectacularly on at least two occasions I don't.....

    Granted one of those occasions was on Netware and the network logon partially failed but ENVIRON is great for stuff ou donj't have to rely on (such as temp directory and so on) but in my experience you cannot rely on it.
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    994
    Provided Answers: 2
    Doesn't ENVIRON return the name associated with the application in question? I'm fairly sure that when my network username was changed, ENVIRON continued to return the old one (in Excel, at least).
    10% of magic is knowing something that no-one else does. The rest is misdirection.

  7. #7
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by weejas View Post
    Doesn't ENVIRON return the name associated with the application in question? I'm fairly sure that when my network username was changed, ENVIRON continued to return the old one (in Excel, at least).
    The case for the persecution (of 'ENVIRON') rests
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •