cant get global variables set through ADO query..

alaric

Registered User.
Local time
Today, 15:41
Joined
Sep 6, 2004
Messages
50
Hi,

What I'm trying to do;
My app is build in modules, for security I want to set variables on startup for the user.
I try to read a table and check for active modules (like adresbook, email etc). All modules can be set active or inactive.

Dim cnn As ADODB.Connection
Set cnn = CurrentProject.Connection
Dim rst As New ADODB.Recordset
Dim strSql As String

strSql = "SELECT ModName, ModAct FROM TSetup;"

rst.Open strSql, cnn, adOpenKeyset, adLockReadOnly

When I try to open the recordset, I can read the first value but I cant get it done to read the 2nd, 3th etc.

then i try to set it as a global vairable so I can read it throughout the whole appl. by
gbolAdresbook = rst.Fields(1).Value

I dont get an error but when i try to read the value (immidiate; ?gboladresbook) theres nothing?

What am I doing wrong? It cant ge that hard, I think

thx in advance
 
red bull quickens the mind and body..

I found the solution myself

Public gbolAdresbook As Boolean
Public gbolEmail As Boolean

Do While Not rst.EOF
If rst.Fields(0).Value = "Adresbook" And rst.Fields(1).Value = "true" Then
gbolAdresbook = True
End If
If rst.Fields(0).Value = "Email" And rst.Fields(1).Value = "true" Then
gbolEmail = True
End If

Maybe someone else can use the info

A
 

Users who are viewing this thread

Back
Top Bottom