J
janetb
I have an sql2000 backend with a file dsn connection within my AccessXP
front-end. Everything working great. For one small place in code, I need to
lookup some records in a second remote sql2000 to which I have permissions. I
have the second remote sql2000 in SQL Enterprise Manager and can query within
Query Analyzer. I've tried to go by the white paper from the msdn site, but
I've run into trouble. Maybe you can help. I want to basically create a
simple report that I can attach to an automated email as a snapshot. Been
doing that with reports from the regular access.mdb connection, but needed
this separate connection to another remote database.
Here's what I've tried, but it gives me the Run-time error of '2593' feature
not available in an mdb and it stops on the me.recorset=rs line. So, any
ideas about what I can do to get the recordset into the report? It's not a
project file, just an mdb.
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strADOCon As String
strADOCon = "Provider=Microsoft.Access.OLEDB.10.0;Data
Provider=sqloledb;Data Source=tada;Initial Catalog=tada;User
Id=tada;Password=tada"
Set cn = New ADODB.Connection
cn.Open strADOCon
Set rs = New ADODB.Recordset
With rs
Set .ActiveConnection = cn
..Source = "Select event_name as [Name] from tada.dbo.tblEvent where
event_pk=15063"
..LockType = adLockOptimistic
..CursorType = adOpenKeyset
..Open
End With
Set Me.Recordset = rs
Set rs = Nothing
Set cn = Nothing
cn.Close
jb
front-end. Everything working great. For one small place in code, I need to
lookup some records in a second remote sql2000 to which I have permissions. I
have the second remote sql2000 in SQL Enterprise Manager and can query within
Query Analyzer. I've tried to go by the white paper from the msdn site, but
I've run into trouble. Maybe you can help. I want to basically create a
simple report that I can attach to an automated email as a snapshot. Been
doing that with reports from the regular access.mdb connection, but needed
this separate connection to another remote database.
Here's what I've tried, but it gives me the Run-time error of '2593' feature
not available in an mdb and it stops on the me.recorset=rs line. So, any
ideas about what I can do to get the recordset into the report? It's not a
project file, just an mdb.
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strADOCon As String
strADOCon = "Provider=Microsoft.Access.OLEDB.10.0;Data
Provider=sqloledb;Data Source=tada;Initial Catalog=tada;User
Id=tada;Password=tada"
Set cn = New ADODB.Connection
cn.Open strADOCon
Set rs = New ADODB.Recordset
With rs
Set .ActiveConnection = cn
..Source = "Select event_name as [Name] from tada.dbo.tblEvent where
event_pk=15063"
..LockType = adLockOptimistic
..CursorType = adOpenKeyset
..Open
End With
Set Me.Recordset = rs
Set rs = Nothing
Set cn = Nothing
cn.Close
jb