Environ
Oct 10, 2006I was given this piece of code the other day by somebody on the forum and it works really well. My question is:
Is there a way, using a similar function that I can retrive the IP address?
Environ("ComputerName")
I was given this piece of code the other day by somebody on the forum and it works really well. My question is:
Is there a way, using a similar function that I can retrive the IP address?
Environ("ComputerName")
Hello,
I use Environ("Username") all the time, most frequently for logging who has done something to a record, and have once used it to log people into the database (very basic, much the same as logging who did what to records).
But I was wondering, how feasible is it as a security measure?
I often use it on the main menu of my DBs to give me a different menu (with more advanced options on) than other users.
Is it really that safe to use it as a means to allow people in, or stopping them? I know that obviously you have to stop them getting in other ways (holding shift for example), but assuming all of that is done, in theory, they should only be able to get in if they can log in as an authorised user?
Don't know why it is just struck me - just curious I suppose!
Hi everyone
I have searched for help on this forum and all over for a while but cannot find the help i need.
I have a database stored in my user area on a schools network. Other users around the school access the database by clicking on a shortcut to it found on their start menu. The database is not split with a fe/be and usernames and passwords are not required to log on, they simply click the link.
I would like to know how I can find out which users have the database open at any given time? I have a piece of software that tells me the computer name but that is no use, I need the users name. Is there a way of pulling this from the network because each user must first log on to their computer using their name and password before they can access the database?
Any suggestions appreciated
James
i have a menu which recognises a user by using the environ function.
the problem i am getting is that with a small number of users the environ function isnt recognised by the system?
it gives them a #name# instead.
the crazy thing is that it also happens on simpler functions such as =Now() and =Date() which is really annoying, as these 3 things are a foundation on anything that is done within the system/!
the majority of users have no problems, which makes it even more annoying!
when i try to go into the properties of the label which has been assigned the function i get a message. (only on affected PC's)
see attached for pic
THANK YOU IN ADVANCE. HELP IS REALLY APPRECIATED!
I have written a code in VBA to get username. The code is strUserName = Environ("Username")
This doesn't seem to work in some computers. Any idea why?
Using Win 7 and Access 2007
db will be split and on a server
If it's possible: Would like to use the Environ username somewhere in the db so the user only sees their records.
Where would I place this? Or is their different code I should be using for this purpose???
I am trying to use the Environ Username function, which i have working! But i want to compare the result with a Username Table to determine if they have access etc...
View 13 Replies View RelatedHow do I use the following as the default value of a textbox in Access2003?
Environ$("USERNAME")
Resolution:
Create Module and insert the following code:
Option Compare Database
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fOSUserName() As String
On Error GoTo fOSUserName_Err
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If lngX <> 0 Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = ""
End If
fOSUserName_Exit:
Exit Function
fOSUserName_Err:
MsgBox Error$
Resume fOSUserName_Exit
End Function
Use this function as default value
=fOSUserName()
Hi I am using the below code for getting Windows Username, this code is working fine when i am using this in lable, however if i use this in a query, it is not working, do it need some kind of autorun?
SELECT Associates.*
FROM Associates
WHERE (((Associates.CorpID)=Environ("UserName")));
Please help.
I have noted a problem on 2 computers using this. There are around 30 or so computers on our network that work fine with this as a value. The majority of the users are at Access 2000 but some have Access XP. The offending machines have Access 2000
One day a persons computer crashed. DP imaged another persons machine and installed the image on the crashed machine as a solution. Since this the =Environ("username") returned #Name$ (not sure of the exact syntax on this). This same trouble surfaced on another machine recently. I unlocked the field so the users could enter their correct name but this can lead to errors and I would like to keep the username locked and read by code.
I checked the references on the offending machine and they were ok. Not sure what else there is to do to rectify this.
If anyone else has had a similar trouble and found the solution I would appreciate hearing about it.
Thanks a lot!!
-----------------------------
Edit:
I just checked the machine and corrected the syntax above. I also found that in a date search form where I have =now$() for a field, the same thing is displayed - #Name$ rather than the date.