RE: Conditional display of records ...
- From: Me <Me@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 8 Aug 2006 16:38:01 -0700
Hi Klatuu,
I am trying to specify the UserName in Query and then use the query
in form, its not wokring. It asks for UserName. On launch of my access
project,
I run this form which calls the function to get the username, I move username
to Public variable in the query. But still when I run the query it asks me for
UserName.
My question is how do I call the function in query to get the UserName and
then
do the rest ...
Thank you,
-Me
"Klatuu" wrote:
Here is a function that will return the userid..
Private Declare Function GetUserNameA Lib "Advapi32" (ByVal strN As String,
ByRef intN As Long) As Long
Public Function GetUserID()
' Gets the userid (5+2) of the current user.
' Put the following in the declarations section:
'Private Declare Function GetUserNameA Lib "Advapi32" (ByVal strN As String,
ByRef intN As Long) As Long
' modified 4/11/02 dbk set default userid for those not on network
'set default to xxx, changed 10 to 20 for length on 2 lines
Dim Buffer As String * 20
Dim Length As Long
Dim lngresult As Long, userid As String
Length = 20
lngresult = GetUserNameA(Buffer, Length)
If lngresult <> 0 Then
userid = Left(Buffer, Length - 1)
Else
userid = "xxxxxxx"
End If
'MsgBox "USERID = " & userid, , "GetUserID()"
GetUserID = UCase(userid)
End Function
"Me" wrote:
Klatuu,
Yes, I can certainly include the userid in query, what's the syntax to use
the userid?
'cause I am not using Access security, I am using the sql server security.
Or on Form_Current, I can find out who is logged on, at that time is there
any way to modify the criteria?
Thank you for your help!
-Me
"Klatuu" wrote:
Use a query based on the table as the record source of the form. Include a
filter criteria in the query that includes or excludes the flagged records
based on the user id.
"Me" wrote:
I have a form to display records based on a flag in database table.
All users should be able to view records flagged 'N' and
only those users with some particular userid should be able to view
records flagged 'Y'.
What's the best way to achieve this?
Thank you,
-Me
- Follow-Ups:
- RE: Conditional display of records ...
- From: Klatuu
- RE: Conditional display of records ...
- References:
- RE: Conditional display of records ...
- From: Klatuu
- RE: Conditional display of records ...
- Prev by Date: RE: Conditional display of records ...
- Next by Date: Re: Check for possible duplicate record
- Previous by thread: RE: Conditional display of records ...
- Next by thread: RE: Conditional display of records ...
- Index(es):
Relevant Pages
|