Sorry, my mistake.
the $-Character has to be left out.
SELECT * INTO [Sheet1] IN 'c:\test.xls' 'Excel 8.0;' FROM ACNAME
should do the trick. Note: Sheet1 not Sheet1$
I tried it with one of my own Access-Databases and it worked this way
Zvoni
: Hi Barkeeper
:
: i tried the sql statment given by you (in query analyzer), but i get an error
: Incorrect syntax near the keyword 'IN'.
: the query was
: SELECT * INTO [Sheet1$] IN 'c:\test.xls' 'Excel 8.0;' FROM ACNAME
:
: did i do something wrong... ???
:
: AWAHI
:
: :
: : Public Sub Export(ByVal Destination As String, ByVal ExtDatabase As String, ByVal ISAMType As String, Byval Source as String)
: : Dim DummySQL As String
: :
: : DummySQL = "SELECT * INTO [" & Destination & "] IN '" & ExtDatabase & "' '" & ISAMType & "' FROM " & Source
: :
: : 'Here Code for Executing the SQL-Statement
: :
: : End Sub
: :
: : Public Sub ExportExcel()
: : Dim DummySQL As String
: :
: : DummySQL = "SELECT * INTO [Sheet1$] IN 'c:\test.xls' 'Excel 8.0;' FROM MySourceInDB"
: :
: : 'Here Code for Executing the SQL-Statement
: :
: : End Sub
: :
: :
: :
: : :
This message was edited by Barkeeper at 2006-5-9 7:21:54
: : : : how do i export data from visual basic to ms-excel be it the data is stored in an access database or sql database
: : : :
: : : :
: : :
: : :
: : : Look up the SQL-Language --> "SELECT ... INTO .... "-Statement!
: : : You'll need an installed ISAM-Driver for Excel! I have a example at home (at work right now). i will post it tomorrow.
: : :
: : : Zvoni
: : : ------------------------------------------
: : : Only stupidity of mankind and the universe
: : : are infinite, but i'm not sure concerning
: : : the universe. A. Einstein
: : :
: : :
: : :
: : :
: :
: : ------------------------------------------
: : Only stupidity of mankind and the universe
: : are infinite, but i'm not sure concerning
: : the universe. A. Einstein
: :
: :
:
:
------------------------------------------
Only stupidity of mankind and the universe
are infinite, but i'm not sure concerning
the universe. A. Einstein