sidharthrshah
Programmer
I have the code for converting an access database to comma delimited file.But it requires recordset that has to be exported and I have to open the recordset before passing it to this function.So how do I do this?
I want all the fields of the table 'sidtable' in recordset.
the table fields are : nam,telno,addr
the access file name is collproj.mdb
Any kind of help will be highly appreciated.
Thanks,
Sidharth.
------------------------------------------------------------
Public Function RecordsetToText(rs As Object, Optional FullPath _
As String, Optional ValueDelimiter As String = " " As Boolean
'PURPOSE: EXPORTS DATA FROM AN ADO RECORDSET TO A TEXT FILE
'PARAMETERS:
'RS: Recordset to Export. Open the recordset before
'passing it to this function
'FullPath (Optional): FullPath of text file.
'if not specified, the function uses app.path +
'rs.txt
'ValueDelmiter (Optional): String to delimiter
'values within a row. If not specified, an empty space
'is used
'RETURNS: True if successful, false if an error occurs
'COMMENTS: Rows are delimited by a carriage return
---------------------------------------------------------
I added the following function but it gives the following error :
Runtime Error '3001':
Arguments are of the wrong type,are out of the acceptab;e range,or are in conflict with one another.
Private Sub Command1_Click()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\My Documents\nimeet\collproj.mdb"
cn.Open
Set rs = cn.OpenRecordset("sidtable"
RecordsetToText rs, "C:\My Documents\nimeet\sidtable.txt", ":"
End Sub
I want all the fields of the table 'sidtable' in recordset.
the table fields are : nam,telno,addr
the access file name is collproj.mdb
Any kind of help will be highly appreciated.
Thanks,
Sidharth.
------------------------------------------------------------
Public Function RecordsetToText(rs As Object, Optional FullPath _
As String, Optional ValueDelimiter As String = " " As Boolean
'PURPOSE: EXPORTS DATA FROM AN ADO RECORDSET TO A TEXT FILE
'PARAMETERS:
'RS: Recordset to Export. Open the recordset before
'passing it to this function
'FullPath (Optional): FullPath of text file.
'if not specified, the function uses app.path +
'rs.txt
'ValueDelmiter (Optional): String to delimiter
'values within a row. If not specified, an empty space
'is used
'RETURNS: True if successful, false if an error occurs
'COMMENTS: Rows are delimited by a carriage return
---------------------------------------------------------
I added the following function but it gives the following error :
Runtime Error '3001':
Arguments are of the wrong type,are out of the acceptab;e range,or are in conflict with one another.
Private Sub Command1_Click()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\My Documents\nimeet\collproj.mdb"
cn.Open
Set rs = cn.OpenRecordset("sidtable"
RecordsetToText rs, "C:\My Documents\nimeet\sidtable.txt", ":"
End Sub