I'd like to schedule a task to export a tab-delimited file based on an Access query. For several reasons, I'd like to do this by running a Visual Basic script. I have the code below, which is producing an error on Line 19 Char 1 ("a = rs.GetString"): Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
Can you help? Here is the code:
db = "path to database"
TextExportFile = "path to text file"
Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
"Provider = Microsoft.Jet.OLEDB.4.0; " & _
"Data Source =" & db
strSQL = "SELECT * FROM QueryName"
rs.Open strSQL, cn, 3, 3
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.CreateTextFile(TextExportFile, True)
a = rs.GetString