|
-
Aug 23rd, 2000, 03:42 AM
#1
Thread Starter
Member
This is the code I've been trying to use from smith voice and VBworld...
Dim db as database
Set db = Workspaces(0).OpenDatabase(app.path & "iblio.mdb")
'commented out syntax followed by working example
'db.execute "SELECT tbl.fields INTO [dbms type;DATABASE=path].[unqualified 'filename] FROM [table or tables]
db.execute "SELECT * INTO [dBase III;DATABASE="C:My Documents].[testa] FROM [authors]"
but it doesn't seem to work with VB6 ADO (Sp4)!!!!
I'm trying to take stuff from my SQL server and exporting it to an excel file.
The statement I use is
export_command.commandtext = select * into [excel 8.0;database=c:\vbcode].[test] from [mytable]
export_command.execute
it keeps on giving me an error about there not existing a database of this name within the SQL server. I don't think it understands I want to get the data out of the SQL server and not put in. Anyone can help me with this one????
-
Aug 23rd, 2000, 11:01 AM
#2
Frenzied Member
You're trying to use a Jet extension of SQL on SQL Server (select into in SQL server, at least in 6.5, will only select into a SQL server table). Your best bet is to create an access database that has a linked table and run your SQL against that.
-
Aug 23rd, 2000, 12:13 PM
#3
Thread Starter
Member
Yes that's what I thought too, some variations of the code I posted will create the table, but only inside the SQL server DB, but you know why smithvoice's code works?
So I should create a linked table and use a built in convert to spread sheet function to change the MDB to excel?
-
Aug 23rd, 2000, 12:20 PM
#4
Frenzied Member
That's what I'd do (assuming you're talking about the TransferSpreadSheet function).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|