Click to See Complete Forum and Search --> : where to set the recordset statement?
titanium
Mar 16th, 2000, 12:38 AM
Where (which subroutine .etc) do I set the recordset and connection, so that I'll be able to access the database throughout the forms?
I had tried to put the statement in form_activate, but I couldn't access the database in another subroutine.
I need to assign a string with my database field.
dim sName as String
sName = adoStudent!Name
can this be done?
TIA
JHausmann
Mar 16th, 2000, 12:49 AM
"Where" is not important, in this instance. In order to acess the data across forms, you need to make the recordset/connection "global" or "public".
titanium
Mar 16th, 2000, 02:31 AM
I change from
Dim myConnection As ADODB.Connection
Dim myRecordSet As ADODB.Recordset
to
Public myConnection As ADODB.Connection
Public myRecordSet As ADODB.Recordset
however it gives a error message of "Invalid attribute in Sub or in Function"
What is wrong??
TIA
JHausmann
Mar 16th, 2000, 03:09 AM
You're probably trying to do the declaration in a form module. It should be done in a code module (in the declaration section).
Edited by JHausmann on 03-16-2000 at 04:12 PM
titanium
Mar 16th, 2000, 01:58 PM
thanks alot.... its working now :)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.