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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box Recordsource

Status
Not open for further replies.

Marryp

Technical User
May 28, 2001
129
CA
Hello :)

Once again I need help!!!

I have an application wherein a user gets validated upon login. The login ID is stored in a variable and access by the function as long for later use. I ran into a problem when I used the function on my where clause as as part of my combo box recordsource. It is very slow. I tried to pass the login ID in the query and it runs a lot faster than using the function. Is there a way I can improve this performance?

Hope someone can help

Mary
 
I would suggest using Access User Level Security instead of your own setup...

That'll open all the over head you've created and to get the currently logged in user name you can use
currentuser()

just my opinion...

--James
junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
Can you post samples?
I use similar techniques in many of my applications and do not have performance issues.

Ken
 
The query below is the recordset in the combo box:

SELECT company.companyID, company.institution_name
FROM user_security INNER JOIN company ON user_security.companyID = company.companyID
WHERE (((user_security.userID)=User()) AND ((user_security.function)="VIEW") AND ((user_security.object)="ART"))
ORDER BY company.institution_name;

---------------Function

Function User() as Long
userid = User
End Function

These are linked tables from SQL.

 
Just a quick observation:
If userid is the global variable where you're storing the Logon ID then the function should be:

Function User() as Long
User = userid
End Function
 
Yeah, that's right

Function User() as Long
User = userid ' userid is the global variable
End Function

I was thinking of just putting a textbox and pass the value of the function to the textbox e.g.

txtHolder = User() ' the textbox will be invisible
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top