I've written an interface and backend in VBA Excel, which interacts with a Firebird database via the Firebird ODBC driver. I had the database running locally, and speed wasn't an issue. I've recently ported it over to a server, which I access over a VPN. The problem is it's very slow.
Granted originally my code was not efficient so I did streamline it. This query returns 1600 rows, in 6 columns. Total runtime is 5 seconds. Should it be taking this long for a query and subsequent paste into a spreadsheet?
mytimer = Timer
Dim conn2 As ADODB.Connection
Dim box As Variant
Set rst2 = New ADODB.Recordset
Set conn2 = New ADODB.Connection
conn2.Open "SOSA"
sql_string = "SELECT * FROM MACHINES"
rst2.Open sql_string, conn2, adOpenDynamic, adLockOptimistic
box = rst2.GetRows
box = Application.Transpose(box)
Dim NumRows As Long
Dim NumCols As Long
NumRows = UBound(box, 1) - LBound(box, 1) + 1
NumCols = UBound(box, 2) - LBound(box, 2) + 1
Range("A2").Resize(NumRows, NumCols).value = box
conn2.Close
MsgBox ((Timer - mytimer))
A side question, I Also I have some code which takes all the cells in a worksheet and INSERTS into a table, and I loop through each row and generate an SQL insert, and execute it, and then next row. Needless to say this is painfully slow. Is there a better way ?