View Full Version : Multiple conditions with stLinkCriteria


jcu123
03-28-2007, 11:57 AM
I have a database that uses Login_id and password to control access and what people see. I use Login_id as stLinkCriteria to open subforms. I have a reports subform that I want only admins to have access to. I have a Security_level field to distinguish Admins (=1) from regular users (=2) and think I should be able to use that in conjunction with the Login_id to do that but I cannot get the syntax right. Here is my current code:

stDocName = "frm_admin_rpts"
stLinkCriteria = "[Login_ID]=" & "'" & Me![Login_ID] & "'"

DoCmd.OpenForm stDocName, , , stLinkCriteria

How do I add "Security_Level=1" to that?

Thanks for any advice!

boblarson
03-28-2007, 12:46 PM
stLinkCriteria = "[Login_ID]=" & "'" & Me![Login_ID] & "' And [Security_Level]=1"

jcu123
03-29-2007, 10:52 AM
Thanks!! I knew it was something so simple I was missing it - and it was.

boblarson
03-29-2007, 10:53 AM
Glad to be of assistance.