Results 1 to 5 of 5

Thread: where to set the recordset statement?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    17
    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

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    "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".

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    17
    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

  4. #4
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    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

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    17
    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
  •  



Click Here to Expand Forum to Full Width