I am trying to create a temporary table or recordset in Visual Basic to massage data in and then use as the source for a DataReport object. I have tried several ways to execute the Create Table command that all fail with "The Open method of the (object) failed" or "The Execute method of the (object) failed". If I execute a 'Select * from Customers' command, it works.
There is supposed to be a way to create an empty recordset object and add fields to it, but I can't get that to work, either.
Here is some code.
Dim cmd As ADODB.Command
Set cmd = New Command
Dim cnx As ADODB.Connection
Set cnx = New ADODB.Connection
strcnx = "Provider = PervasiveOLEDB;Data Source=StarTracer;Password=<pwd>;User ID=Master;Persist Security Info=True"
cnx.CursorLocation = adUseClient
'use the open method of the connection object
cnx.Open strcnx
cnx.Execute "select * from customers", , adExecuteNoRecords
'this fails on Create Table but succeeds on Select *
'ok, now try the execute method of the command object
cmd.ActiveConnection = cnx
cmd.CommandType = adCmdText
cmd.CommandText = "create table #temp1 (fld1 integer)"
cmd.Execute
'Set rs = cmd.Execute()