Passing Objects

Results 1 to 2 of 2

Thread: Passing Objects

  1. #1
    Join Date
    Dec 1969

    Default Passing Objects

    Is it OK to pass the Database and Recordset Objects from one procedure or function to another.<BR><BR>Sub Tom(byRef Conn, byRef RST)<BR> .....<BR>End Sub<BR><BR>Sub Main()<BR> ....<BR> Call Tom(Conn, RST)<BR>End Sub<BR><BR>Can it be done? If not, what would you recommend?

  2. #2
    John Harvey Guest

    Default RE: Passing Objects

    Hi Tom,<BR> Unless you are connecting to several databases, I would recommend using a global ADO.Connection. In all likelyhood, you will have multiple recordsets that are all in the same database. I&#039m not sure about passing the Recordset as a parameter, I&#039ll see if I can do it and let you know. I written subroutines with an SQL statement as an argument before. You can use a single recordset, but perform operations on it and close it, then call the sub with a new SQL statement.<BR><BR>Sub John (SQLCommand)<BR> RST.Open SQLCommand, ADO_Conn, adOpen..., adLock...<BR> ...<BR> RST.Close<BR>End Sub<BR><BR>Hope it helps.<BR>Regards,<BR>John Harvey

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts