how do I query the current Win logon id in a nonsecure Access db

A

ann

I've seen this done. Querying for CurrentUser() returns Admin as expected.
But we need to capture the Windows logon id used by each MS Access user to
identify the records he is updating on a linked SQL Server database. I have
everything except how to capture his logon id as a field in my query. This
Access application does not need to be secured.

thanks much
 
A

ann

Apologies - when I went through the MS prescreen page it returned "no related
answers" and suggested I post. Now that I'm in the forum I do see some
familiar information.

But I do need some basic help: Should I copy the GetUserName function into
a module anywhere? Then create a query field with Criteria =GetUserName? Or
a field UserID:GetUserNameA (syntax?)
 
J

John Spencer

Copy the module into a VBA module.

Then you can use
fOSUserName()
to return the current windows user name.

You would NOT use that as criteria, but as a calculated field in a query. But
since you want to store this value, you could use this as the default value of
a control on a form where the control was bound to the relevant field in your
table.
= fOSUSerName

Or you could use the Before Update event of the form to populate the field by
setting its value.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top