First, you will need a field in your table that identifies to whom the
projects belong.
Second, you can set the forms Filter property to filter on the User.
Third, you will need to capture the user id so you can set the form's filter.
Here is a function that will return the userid. It should be in a standard
module
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
GetUserID = UCase(userid)
End Function
Now, to set the filter, put this in the Load event of the form:
Me.Filter = "[ProjectOwner] = '" & GetUserID & "'"
Me.FilterOn = True
The only issue you have here is matching the name of the project owner with
the user id. They will likely not be the same. It may be necessary to
either change the value in whatever field has the project owner's name to
their user id or create a crossreference table to translate the userid to
their name. The first solution would be the preferred way to do it.