1. Copy and paste your function code into a module
2. where ever you need to use the function simply 'call it'. For Instance:
If you wanted to check the fOSUserName when a Form is opened using a form's
open event you'd code it like:
Private Sub Form_Open(Cancel As Integer)
If fOSUserName() = "ryguy7272" then
'All is good continue opening the form
Else
'Unauthorized Access
Cancel =True
End if
End Sub

Signature
Hope this helps,
Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.com/index.php
Please rate this post using the vote buttons if it was helpful.
> I trying to run a function, but can’t quite figure out how to call it. The
> Access Bible says that you have to add a function call to the Control Source
[quoted text clipped - 26 lines]
> Thanks so much!!
> Ryan---
Yes, this does help, but I'm still not clear on how to use this function. I
want to confirm who logs into a DB. Does it make sense to have a list of
users in a Table, and then, let's say have a LoginID, which comes from the
system itself. Then get the DB to match the fields in the user listed in the
Table with the LoginID? Does this make sense? I guess I could get each user
to give me an ID, and then enter that into the system, but I would like to
automate this process as much as possible. Is there an example online that
explains how to do this. I have the Access 2007 Bible, but the books'
coverage of this topic is kind of weak.
Regards,
Ryan---

Signature
RyGuy
> 1. Copy and paste your function code into a module
>
[quoted text clipped - 43 lines]
> > Thanks so much!!
> > Ryan---
Klatuu - 22 May 2008 23:20 GMT
The code you have will return the Windows Login for the user currently logged
in to the workstation. You don't need a table unless you want to restrict
access to your database.
Let's say you want to have a control on a form that that shows the user
login. There are two different ways to do this. If you wanted to store the
user name in the form's recordset, you would have to use the form's Load
event to populate the control:
Me.txtUser = fOSUserName
But, if you only want to display it, you can use the control's Control
Source property. In the property dialog for the Control Source Property, you
would type in:
=fOSUserName()
The = and () are both required.

Signature
Dave Hargis, Microsoft Access MVP
> Yes, this does help, but I'm still not clear on how to use this function. I
> want to confirm who logs into a DB. Does it make sense to have a list of
[quoted text clipped - 56 lines]
> > > Thanks so much!!
> > > Ryan---
ryguy7272 - 23 May 2008 00:46 GMT
Thank you so much! Just what I was looking for!!
Regards,
Ryan---

Signature
RyGuy
> The code you have will return the Windows Login for the user currently logged
> in to the workstation. You don't need a table unless you want to restrict
[quoted text clipped - 73 lines]
> > > > Thanks so much!!
> > > > Ryan---