Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fiter records

Status
Not open for further replies.

aspnetuser

Technical User
Sep 9, 2004
273
US
I have a procedure i call from a module that gets the current user name. I call this function from a form in which i want to filter records on based on who is logged in. I tried everything and the filter does not work

((((vwE.Auth)=[Forms]![frmLogin]![LoginName])))

Please advise another way to do this. How can I filter records based on a unbound field i populate with a call to a module? I tried everything.

access 2002 project.
 
What I do is when the user logins in save the login name in a public variable in the standard module, then return the name through a function in the query/filter.

In standard module.
Public pubUserName as String

Public Function ReturnUserName() AS String
ReturnUserName=pubUserName
End Function

Query. note chr(34) to put double quotes around string var.
vwE.Auth = chr(34) & ReturnUserName() & chr(34)
 
Can you code out the filter part?

Do i do that in the filter property on the form?

 
How do you want to execute the SQL? Through the record source on a Bound Form? What is the record source?

Could be something like.
Me.Filter = "vwE.Auth = " chr(34) & ReturnUserName() & chr(34)
 
Got it. Thanks for your help. It is working now.

Thanks!

Regards,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top