Multi filter referencing field on form

ECEK

Registered User.
Local time
Today, 07:17
Joined
Dec 19, 2012
Messages
717
Just having trouble getting my filter to work:

Code:
Dim strMyLast As String

strMyLast = "Status <> 'Completed' And User = Me.UserName"

Debug.Print strMyLast

Me.Filter = strMyLast
Me.FilterOn = True

Im trying to filter my form by everything not completed and by the a field called userName that appears on my Form.

Any ideas?
 
You need to concatenate Me.UserName into the string otherwise it will be literally Me.UserName instead of its valued. Assuming User is a text field this would be something like:
Code:
strMyLast = "Status <> 'Completed' And User = '" & Me.UserName & "'"
 
Try strMyLast = "Status <> 'Completed' And User = '" & Me.UserName & "'"
 
Thanks Guys
I tried Gasman's solution and it works perfectly.
Many thanks.
 
I just happened to try yours first and it worked ! I didn't need to compare.
 

Users who are viewing this thread

Back
Top Bottom