|
-
Mar 16th, 2000, 01:38 AM
#1
Thread Starter
Junior Member
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
-
Mar 16th, 2000, 01:49 AM
#2
Frenzied Member
"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".
-
Mar 16th, 2000, 03:31 AM
#3
Thread Starter
Junior Member
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
-
Mar 16th, 2000, 04:09 AM
#4
Frenzied Member
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
-
Mar 16th, 2000, 02:58 PM
#5
Thread Starter
Junior Member
thanks alot.... its working now
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|