K
Kakha
It's posible to create Disconnected ADODB.Recordset via RDSServer.DataFactory dinamically.
But when I bind this recordset to MS Access form, I get unexpected behavior or sometimes Access fails (both MDB & ADP).
There is sample
ACCESS MODULE
====================
Public dc As RDS.DataControl
Public r1 As ADODB.Recordset
Public df As RDSServer.DataFactory
Public Sub Openform2()
Dim vntRecordShape(1)
Dim vntField1Shape(3)
Dim vntField2Shape(3)
' For each field, specify the name,
' type, size, and nullability.
vntField1Shape(0) = "Name" ' Column name.
vntField1Shape(1) = CInt(129) ' Column type.
vntField1Shape(2) = CInt(40) ' Column size.
vntField1Shape(3) = False ' Nullable?
vntField2Shape(0) = "Age"
vntField2Shape(1) = CInt(3)
vntField2Shape(2) = CInt(-1)
vntField2Shape(3) = True
' Put all fields into an array of arrays.
vntRecordShape(0) = vntField1Shape
vntRecordShape(1) = vntField2Shape
Dim fields(1)
fields(0) = vntField1Shape(0)
fields(1) = vntField2Shape(0)
Set df = New RDSServer.DataFactory
Set r1 = df.CreateRecordSet(vntRecordShape)
' Populate the new recordset with data values.
Dim fieldVals(1)
' Use AddNew to add the records.
fieldVals(0) = "Joe"
fieldVals(1) = 5
r1.AddNew fields, fieldVals
fieldVals(0) = "Mary"
fieldVals(1) = 6
r1.AddNew fields, fieldVals
r1.MoveFirst
DoCmd.OpenForm "Form2", acNormal
Set Forms!form2.Recordset = r1
End Sub
==============================
if I bind the form to a ADODB.Recordset, that have been created by
r1.Open "table",CurrentProject.Connection
everithing is fine.
Is any way out?
But when I bind this recordset to MS Access form, I get unexpected behavior or sometimes Access fails (both MDB & ADP).
There is sample
ACCESS MODULE
====================
Public dc As RDS.DataControl
Public r1 As ADODB.Recordset
Public df As RDSServer.DataFactory
Public Sub Openform2()
Dim vntRecordShape(1)
Dim vntField1Shape(3)
Dim vntField2Shape(3)
' For each field, specify the name,
' type, size, and nullability.
vntField1Shape(0) = "Name" ' Column name.
vntField1Shape(1) = CInt(129) ' Column type.
vntField1Shape(2) = CInt(40) ' Column size.
vntField1Shape(3) = False ' Nullable?
vntField2Shape(0) = "Age"
vntField2Shape(1) = CInt(3)
vntField2Shape(2) = CInt(-1)
vntField2Shape(3) = True
' Put all fields into an array of arrays.
vntRecordShape(0) = vntField1Shape
vntRecordShape(1) = vntField2Shape
Dim fields(1)
fields(0) = vntField1Shape(0)
fields(1) = vntField2Shape(0)
Set df = New RDSServer.DataFactory
Set r1 = df.CreateRecordSet(vntRecordShape)
' Populate the new recordset with data values.
Dim fieldVals(1)
' Use AddNew to add the records.
fieldVals(0) = "Joe"
fieldVals(1) = 5
r1.AddNew fields, fieldVals
fieldVals(0) = "Mary"
fieldVals(1) = 6
r1.AddNew fields, fieldVals
r1.MoveFirst
DoCmd.OpenForm "Form2", acNormal
Set Forms!form2.Recordset = r1
End Sub
==============================
if I bind the form to a ADODB.Recordset, that have been created by
r1.Open "table",CurrentProject.Connection
everithing is fine.
Is any way out?