![]() |
|
|
Welcome to the { mindfrost82.com } forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Re: Network user name
You can find the code here:
http://www.mvps.org/access/api/api0008.htm Put this function in the text box's default value property. =fOSUserName() Chris Microsoft MVP slickdock@yahoo.com wrote: >How can I default a field in Access to equal the name the user is >logged in to the Windows server network as? -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ccess/200809/1 |
|
|||
|
Re: Network user name
<slickdock@yahoo.com> wrote in message
news:830d3bb6-d592-443c-a3f5-b8facc686ac9@w1g2000prk.googlegroups.com... > How can I default a field in Access to equal the name the user is > logged in to the Windows server network as? First get the network username: http://www.mvps.org/access/api/api0008.htm and paste it into a module. Then set the default value property of the textbox to: =fOSUsername() which is the name of the function at the hyperlink above. -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com |
|
|||
|
RE: Network user name
And make sure to name the module something OTHER than the function name
(fOSUsername). -- Bob Larson Free Tutorials and Samples at http://www.btabdevelopment.com __________________________________ "slickdock@yahoo.com" wrote: > How can I default a field in Access to equal the name the user is > logged in to the Windows server network as? > |
|
|||
|
Re: Network user name
On Sep 8, 7:39*pm, boblarson <boblar...@discussions.microsoft.com>
wrote: > And make sure to name the module something OTHER than the function name > (fOSUsername). > -- > Bob Larson > > Free Tutorials and Samples athttp://www.btabdevelopment.com > > __________________________________ > > > > "slickd...@yahoo.com" wrote: > > How can I default a field in Access to equal the name the user is > > logged in to the Windows server network as?- Hide quoted text - > > - Show quoted text - Beautiful! Thank you everyone! It works perfectly for the [RecordCreatedBy] field. How can I make it work for the [RecordRevisedBy] field? I assume I have to assign a macro to the Before Update property of the form that Runs Code =fOSUsername() and places that value in the [RecordRevisedBy] field, but my lame attempts have failed due to my limited VBA experience. |
|
|||
|
Re: Network user name
It would just be:
Me!RecordRevisedBy = fOSUsername() -- Bob Larson Free Tutorials and Samples at http://www.btabdevelopment.com __________________________________ "slickdock@yahoo.com" wrote: > On Sep 8, 7:39 pm, boblarson <boblar...@discussions.microsoft.com> > wrote: > > And make sure to name the module something OTHER than the function name > > (fOSUsername). > > -- > > Bob Larson > > > > Free Tutorials and Samples athttp://www.btabdevelopment.com > > > > __________________________________ > > > > > > > > "slickd...@yahoo.com" wrote: > > > How can I default a field in Access to equal the name the user is > > > logged in to the Windows server network as?- Hide quoted text - > > > > - Show quoted text - > > Beautiful! Thank you everyone! It works perfectly for the > [RecordCreatedBy] field. > How can I make it work for the [RecordRevisedBy] field? I assume I > have to assign a macro to the Before Update property of the form that > Runs Code =fOSUsername() and places that value in the > [RecordRevisedBy] field, but my lame attempts have failed due to my > limited VBA experience. > |
|
|||
|
RE: Network user name
I followed you guys' instructions:
I created a module, pasted the code in a new module, named the new module "GET USERNAME", created anew form, inserted an unbound text box, and set the default value property to "=fOSUserName()" ....but all I get is "#Name?" in the text box. SO there's something I am not doing correctly... I am not a programmer...Please advise me. THANX. -St8employee "boblarson" wrote: > And make sure to name the module something OTHER than the function name > (fOSUsername). > -- > Bob Larson > > Free Tutorials and Samples at http://www.btabdevelopment.com > > __________________________________ > > > "slickdock@yahoo.com" wrote: > > > How can I default a field in Access to equal the name the user is > > logged in to the Windows server network as? > > |
|
|||
|
Re: Network user name
So I followed your instructions exactly and it worked as expected. I can see
a possible mistake that you may have made: You didn't copy all of the code, specifically the declare: Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "st8employee" <st8employee@discussions.microsoft.com> wrote in message news:B737E096-5DCF-4F75-90F1-8BBC9A76A74A@microsoft.com... >I followed you guys' instructions: > > I created a module, > pasted the code in a new module, > named the new module "GET USERNAME", > created anew form, > inserted an unbound text box, > and set the default value property to "=fOSUserName()" > > ...but all I get is "#Name?" in the text box. SO there's something I am > not > doing correctly... > > I am not a programmer...Please advise me. THANX. > > -St8employee > > > "boblarson" wrote: > >> And make sure to name the module something OTHER than the function name >> (fOSUsername). >> -- >> Bob Larson >> >> Free Tutorials and Samples at http://www.btabdevelopment.com >> >> __________________________________ >> >> >> "slickdock@yahoo.com" wrote: >> >> > How can I default a field in Access to equal the name the user is >> > logged in to the Windows server network as? >> > |
|
|||
|
Re: Network user name
I copied everything from where it says ***code start*** to where it says
***code end*** ...asteriks and all... what am I doing wrong...? (I am really a novice with programming...have literally NO experience outside of writing complex command strings in Access query criteria and building snazzy macros...) "Arvin Meyer [MVP]" wrote: > So I followed your instructions exactly and it worked as expected. I can see > a possible mistake that you may have made: > > You didn't copy all of the code, specifically the declare: > > Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _ > "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long > -- > Arvin Meyer, MCP, MVP > http://www.datastrat.com > http://www.mvps.org/access > http://www.accessmvp.com > > > "st8employee" <st8employee@discussions.microsoft.com> wrote in message > news:B737E096-5DCF-4F75-90F1-8BBC9A76A74A@microsoft.com... > >I followed you guys' instructions: > > > > I created a module, > > pasted the code in a new module, > > named the new module "GET USERNAME", > > created anew form, > > inserted an unbound text box, > > and set the default value property to "=fOSUserName()" > > > > ...but all I get is "#Name?" in the text box. SO there's something I am > > not > > doing correctly... > > > > I am not a programmer...Please advise me. THANX. > > > > -St8employee > > > > > > "boblarson" wrote: > > > >> And make sure to name the module something OTHER than the function name > >> (fOSUsername). > >> -- > >> Bob Larson > >> > >> Free Tutorials and Samples at http://www.btabdevelopment.com > >> > >> __________________________________ > >> > >> > >> "slickdock@yahoo.com" wrote: > >> > >> > How can I default a field in Access to equal the name the user is > >> > logged in to the Windows server network as? > >> > > > > |
|
|||
|
Re: Network user name
Did you use:
"=fOSUserName()" or: =fOSUserName() -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "st8employee" <st8employee@discussions.microsoft.com> wrote in message news:9C64BB12-E3D6-4725-B128-80BE88F29208@microsoft.com... >I copied everything from where it says ***code start*** to where it says > ***code end*** ...asteriks and all... > > what am I doing wrong...? (I am really a novice with programming...have > literally NO experience outside of writing complex command strings in > Access > query criteria and building snazzy macros...) > > "Arvin Meyer [MVP]" wrote: > >> So I followed your instructions exactly and it worked as expected. I can >> see >> a possible mistake that you may have made: >> >> You didn't copy all of the code, specifically the declare: >> >> Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _ >> "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long >> -- >> Arvin Meyer, MCP, MVP >> http://www.datastrat.com >> http://www.mvps.org/access >> http://www.accessmvp.com >> >> >> "st8employee" <st8employee@discussions.microsoft.com> wrote in message >> news:B737E096-5DCF-4F75-90F1-8BBC9A76A74A@microsoft.com... >> >I followed you guys' instructions: >> > >> > I created a module, >> > pasted the code in a new module, >> > named the new module "GET USERNAME", >> > created anew form, >> > inserted an unbound text box, >> > and set the default value property to "=fOSUserName()" >> > >> > ...but all I get is "#Name?" in the text box. SO there's something I am >> > not >> > doing correctly... >> > >> > I am not a programmer...Please advise me. THANX. >> > >> > -St8employee >> > >> > >> > "boblarson" wrote: >> > >> >> And make sure to name the module something OTHER than the function >> >> name >> >> (fOSUsername). >> >> -- >> >> Bob Larson >> >> >> >> Free Tutorials and Samples at http://www.btabdevelopment.com >> >> >> >> __________________________________ >> >> >> >> >> >> "slickdock@yahoo.com" wrote: >> >> >> >> > How can I default a field in Access to equal the name the user is >> >> > logged in to the Windows server network as? >> >> > >> >> >> |
![]() |
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|