Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

ODBC excel VBA

  Asked By: Hayfa    Date: Aug 14    Category: MS Office    Views: 1761
  

I am working on excel macro that extract data from database file
using SQL. I have managed to extract some data. Unfortunately it is
limited only to about 26 line of data. Any help would be much
appreciated.

Here is part of my code:
Dim qt As QueryTable
sqlstring = InputBox("Enter SQL")
connstring = "ODBC;DSN=;Database="
With ActiveSheet.QueryTables.Add(Connection:=connstring, _
Destination:=Range("A1"), Sql:=sqlstring)
.Refresh
End With

I use this in File DSN configuration:
[ODBC]
DRIVER=Microsoft dBase Driver (*.dbf)
UID=admin
UserCommitSync=Yes
Threads=3
Statistics=1
SafeTransactions=0
PageTimeout=5
MaxScanRows=8
MaxBufferSize=2048
FIL=dBase IV
Exclusive=1
DriverId=277
Deleted=0
DefaultDir=H:\
CollatingSequence=ASCII

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Feodora Bonkob     Answered On: Aug 14

it's strange that it works but is limited to 26 lines. Is it
possible that 26 records is all that the SQL statement produces from
the database? (ie have you tried a "SELECT * FROM <table>" to see if
it returns more?)

 
Didn't find what you were looking for? Find more on ODBC excel VBA Or get search suggestion and latest updates.




Tagged: