UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Username Capture    
 
   
robbya2
post Apr 17 2012, 08:44 AM
Post #1

UtterAccess Veteran
Posts: 388



Hi,

We have a comments form that has a hidden field's data source set to (environ("username"). When the comment is saved that entry is used to set the user name of the person entering the comment. Lately (since being updated to MS2010) some of the users names are not recorded in the table and after troubleshooting I have found that this username field is not being set for some users. If I run a test msgbox environ("username") it gives the right value...
I have a workaround to have the load event set the value of the textbox but I am just wondering if there is a known cause for the loss of that function in the data source of the text box....

Thanks,

Robby
Go to the top of the page
 
+
accesshawaii
post Apr 17 2012, 08:48 AM
Post #2

UtterAccess VIP
Posts: 4,582
From: From Hawaii - Now in Wisconsin...Am I Nuts?



I've used that in 2010 and never had any problems. I know if you don't have the brackets around it, it sometimes throws it off e.g. strUser=Trim(Environ("UserName"))
Go to the top of the page
 
+
Peter46
post Apr 17 2012, 08:57 AM
Post #3

UtterAccess VIP
Posts: 7,394
From: Oadby Leics, UK



Environ() is classified as an Unsafe command in Office terms.
To get round this without changing your application you will have to set macro security to low.
I would not normally suggest because I think macros should be prevented from running without the user's approval.

The 'proper' approach now, is to use a function to get the username. This can be a wrapper function for the Environ() function itself, or you can use a method which gets the Windows login name.
Go to the top of the page
 
+
BruceM
post Apr 17 2012, 09:15 AM
Post #4

UtterAccess VIP
Posts: 2,444
From: Downeast Maine



QUOTE
I think macros should be prevented from running without the user's approval


I have found that in most cases users view pop-up messages as things to dispose of as quickly as possible. If the standard procedure is to click through macro advisories there seems little point to having them, IMHO.

I'm not saying that routinely clicking through pop-up messages is a good thing, but rather that it often seems to be the norm.
Go to the top of the page
 
+
robbya2
post Apr 17 2012, 09:23 AM
Post #5

UtterAccess Veteran
Posts: 388



Thank you for the information, I tried this but it does the same thing.


Robby
Go to the top of the page
 
+
accesshawaii
post Apr 17 2012, 10:37 AM
Post #6

UtterAccess VIP
Posts: 4,582
From: From Hawaii - Now in Wisconsin...Am I Nuts?



Peter is right, an API call is generally the preferred method but if security is not a real high-concern then going with environ user is ok.

It's hard to say what the problem is without actually seeing your database. Could you upload a stripped down version of it?
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 18th May 2013 - 12:26 AM

Tag cloud: