General information
Category:
Database DAO/RDO/ODBC/ADO
Here is the code
Dim Rs As ADODB.Recordset
Dim Str As String
Dim rstMemory As ADODB.Recordset
'================================================= 'Create an in memory recordset to build the view for the grid
=================================================
Set rstMemory = New ADODB.Recordset
With rstMemory
.CursorLocation = adUseClient
.LockType = adLockPessimistic
.Fields.Append "Entity", adVarChar, 50
.Fields.Append "EntityCode", adVarChar, 50
.Fields.Append "Total", adDouble
.Fields.Append "Price", adDouble
.Open
End With
================================================= 'Fill the In-memory recordset with data
=================================================
rstMemory.AddNew
rstMemory!Entity = "This is the Entity"
rstMemory!EntityCode = "Code"
rstMemory.Fields("Total") = 1.23
rstMemory.Fields("Price") = 4.56
rstMemory.Update
CnConnection
Str = "Select * From rstMemory"
Call RsConnection(Str, Rs)
Private Sub CnConnection()
Set MasterCn = New ADODB.Connection
MasterCn.Provider = "Microsoft.jet.OLEDB.3.51"
MasterCn.ConnectionString = " " 'Mdb Path
MasterCn.Open
End Sub
Private Sub RsConnection(RsStr As String, RsName As ADODB.Recordset)
Set RsName = New ADODB.Recordset
With RsName
.ActiveConnection = MasterCn
.CursorType = adOpenDynamic
.CursorLocation = adUseServer
.LockType = adLockOptimistic
.Source = RsStr
.Open 'At this line it gives me error rstMemory not found
End With
End Sub
Amol
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only