Hi,
I'm getting an error when try to open up my login form I've taken this code from a sample Getuser() database, but I can't seem to figure out what I'm missing.
Compile Error:
User-defined type not defined
Code:
Option Compare Database
Function isAdmin() As Boolean
Dim LID As Variant
LID = GetUser()
Dim strSQL As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
strSQL = "Select * from dbo_AdminTable where LoginID = '" & LID & "'"
rs.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockReadOnly
If rs.EOF And rs.BOF Then
isAdmin = False
Else
isAdmin = True
End If
rs.Close
Set rs = Nothing
End Function
Function retFullName() As String
Dim strSQL As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
strSQL = "Select * from dbo_AdminTable where LoginID = '" & GetUser() & "'"
rs.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockReadOnly
If rs.EOF And rs.BOF Then
retFullName = "Name Not Found"
Else
retFullName = rs!FirstName & " " & rs!LastName
End If
rs.Close
Set rs = Nothing
End Function
Function retSecDescription() As String
Dim strSQL As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
strSQL = "SELECT dbo_LookupSecurity.SecurityDescription, dbo_AdminTable.LoginID" _
& " FROM dbo_AdminTable INNER JOIN dbo_LookupSecurity ON dbo_AdminTable.SecurityLevel = dbo_LookupSecurity.SecurityLevel" _
& " WHERE (((dbo_AdminTable.LoginID)= '" & GetUser() & "'))"
rs.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockReadOnly
If rs.EOF And rs.BOF Then
retSecDescription = "Unknown"
Else
retSecDescription = rs!SecurityDescription
End If
rs.Close
Set rs = Nothing
End Function
Function retSecNum() As Integer
Dim strSQL As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
strSQL = "Select * from dbo_AdminTable where LoginID = '" & GetUser() & "'"
rs.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockReadOnly
If rs.EOF And rs.BOF Then
retSecNum = 1
Else
retSecNum = rs!SecurityLevel
End If
rs.Close
Set rs = Nothing
End Function
The
Code:
rs As ADODB.Recordset
is highlighted.
My user name is able to fill in correctly, however the "Your Name", "Security Level", and "Security Description" is getting an error.
Your help is greatly appreciated.