copying one recordset to another recordset through function
Posted on 2001-09-07
For quality answers I will gladly raise up to another 50 points.
1.I have provided more information than is probably necessary, but I cannot figure out the solution. How do I copy a recordset to another recordset. The following code fails at the line getRecordSet = rst?
Public Function getRecordSet(strDBPath As String, strSQL As String) As ADODB.Recordset
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Set cnn = New ADODB.Connection
' Open the connection.
.Provider = "Microsoft.Jet.OLEDB.4.0"
Set rst = New ADODB.Recordset
' Open the Recordset object.
.Open Source:=strSQL, _
'Error with the nextStatement
getRecordSet = rst
' Close connection and destroy object variables.
Set rst = Nothing
Set cnn = Nothing
2.I have a data object with a record source that JOINs several tables together(Look below for sql). Can the fields in the data.recordset be edited. If so how (the data.recordset.edit command give me an error telling me that the database or object is read only)? The record source with information from one table can be edited.
Const sqlMain As String = "SELECT Table_IssuesResolution.Issue, Table_IssuesResolution.Resolution, " & _
"TableFiles.Files, Table_Owner.Owner,Table_IssuesResolution.Owner, Table_Category.CategoryType, Table_Status.Status, " & _
"Table_IssuesResolution.ID, Table_IssuesResolution.Category FROM Table_Status RIGHT JOIN ((Table_Owner RIGHT JOIN " & _
"(TableFiles RIGHT JOIN Table_IssuesResolution ON TableFiles.FileID = " & _
"Table_IssuesResolution.ID) ON Table_Owner.ID = Table_IssuesResolution.Owner) LEFT JOIN " & _
"Table_Category ON Table_IssuesResolution.Category = Table_Category.ID) ON " & _
"Table_Status.Status_ID = Table_IssuesResolution.Status"