Disconnected Recordset function in remote MDE file
- From: rsclnet@xxxxxxxxx
- Date: 1 Nov 2005 23:49:02 -0800
What am i doing wrong? I'm a newbie
I have the following code:
'''''''START CODE'''''''''''''
Option Compare Database
Option Explicit
Public rstTariffs As ADODB.Recordset
Public Sub createDiscRecordset(Rec2Fill As Recordset, strDBpath As
String, strNameQuery As String)
'This function fills recordsets and disconnects them
On Error Resume Next
Dim strSQL, strConn As String
Dim rs As New ADODB.Recordset
rs.CursorLocation = adUseClient
strConn = "Driver={Microsoft Access Driver (*.mdb)};Dbq=" &
strDBpath & ";Uid=;Pwd=;"
rs.Open strNameQuery, strConn, adOpenStatic, adLockBatchOptimistic
'Disconnect the recordset
Set rs.ActiveConnection = Nothing
'Return the recordset
Set thaRecordset2Fill = rs
End Sub
Public Sub test()
Dim strPath As String
strPath = "c:\test.mdb"
Call createDiscRecordset(rstTariffs, strPath, "select * from
tariffs")
Debug.Print rstTariffs.RecordCount
End Sub
'''''''END CODE'''''''''''''
It works fine if I leave all the code in the local database.
But i want to put the code from sub createDiscRecordset in an remote
mde file and reference to it.
But upon running it after putting the code in the mde file. It does not
seem to work. When running the test sub, i get the following message
'91 : Object variable or With block variable not set'.
Please advice.
Thank you
.
- Follow-Ups:
- Re: Disconnected Recordset function in remote MDE file
- From: rsclnet@xxxxxxxxx
- Re: Disconnected Recordset function in remote MDE file
- Prev by Date: advantage of sprocs
- Next by Date: Re: Disconnected Recordset function in remote MDE file
- Previous by thread: advantage of sprocs
- Next by thread: Re: Disconnected Recordset function in remote MDE file
- Index(es):
Relevant Pages
|
|