Access Help

Associate
Joined
18 Dec 2002
Posts
1,542
Location
Cardiff
I'm currently working on a Security check for my access database but am having a problem.

I have a function that returns the Users Name from the api dll, which is working.
I also have a Security table in my database that holds logon ids and security levels.

Basically, what I want is:

User presses button to open a certain form
Security check is made
If user doesnt have the level the form doesnt open
If user has access then open form.

The code I had writen was:

Code:
Dim sSQL As String
    Dim rs As ADODB.Recordset
    
    sSQL = "SELECT [Security].[Level] FROM Security WHERE (([Security].[UserID])=fncUserName())"
    
    rs.Open sSQL

But it's returning an error. I was looking to have it check to see if any rows are returned, and if so, what security level the row had.
 
Run-time error '91':

Object variable or With block variable not set

Which is being caused by the line rs.Open sSQL
 
Back
Top Bottom