try the help system for ENVIRON
strSetting=ENVIRON(<key>) or strSetting=ENVIRON(<index>)
note the environment settings are machine / platform independant so the index is 'stuff all' use unless you want to view what environ settigns your platform supports. You cannot rely that the same <index> will retrieve the same info on each call even on the same machine
I did a snapshot of 4..5 machines to find the environ settings we are comfortable with these are
"TEMP" & / or "TMP" to fidn the location of the current PC's temp / scratch work area
"NWUSERNAME" the Novell user logon
"COMPUTERNAME" the PC NETBIOS NAME
"USERNAME" the local PC account
So to find the netware logon:- strSetting=Environ("nwusername")
To find the current PC account:- strSetting=Environ("username")
But theres a lot more to it, you can find all manner of stuff, not sure what you'd use for though. This should give a pointer, come back if you need a few more assistance. I did a dump to a flat file iterating through using the key 1..255 to retrieve all the ENVIRON variables. This is detailed in an application note I wrote for a site detailing the <keys> discovered which were of possible use on XP machines
Last edited by healdem; 11-23-04 at 06:49.
Reason: lousy spelling
Basically ive got a form that updates a file on each of the users desktop, the file that calls this updating form is the FE itself that is to be overwritten, but the update form needs to know where to put the file and as each user will be doing this it will need to be generically coded so that each copy can download the file to the userprofile i.e c:\winnt\profiles\username\desktop\...
Sorry can't read that db, I get user doesn't have adequate security to read or change database
have you checked what environ variables area available on your machine?
is it terminology but i read environ as read only - you can't set anything.
You do need to check the environment variable you want is on all the machines you want to use it on. It is platform (OS) specific. It works on XP, 2000, & NT, it works partially in 98, and not at all on 95 & 3,3.1.
It is all referred to in the help file / and or microsoft site if you search for environ, or in the code window highlight environ & press F1
I read this, and have used elsewhere environ to retrieve what you want
eg strPathtoDesktop=envrion("USERPROFILE") & "\DESKTOP"
on this pc it sets strPathtoDesktop to "c:\documents and settings\za9ra29\desktop"
I would expect problems with older machines but not newer PC's
You do need to check it works on your machines before deployment
Why would you want to set an environment varaiable. the whole point of them is that the already exist, are defined and valid. if you tinker with them you may screw not just your application but others running elsewhere/elsewhen.