One issue is that ODBC is old technology, becoming outdated. There may
be other issues, based on your setup, but ODBC technology is one of the
bigger issues. ADO technology is much more reliable and way faster
because it has way more bandwidth than ODBC.
There are two kinds of ADO, com ADO and ADO.Net. For Access you would
use com ADO. For that you need to download Mdac2.5 and Mdac2.6.
Mdac2.5 contains Jet3.51 or 3.6 or something that you need for Jet.
Mdac2.6 is the upgraded version of 2.5 (more reliable). Mdac2.7+ I
believe is for .Net (maybe 2.8, but you don't need this for Access, but
definitely Mdac2.5 and 2.6).
ADO uses disconnected datasets where ODBC is a constant connection to
the datasource, thus ODBC has way lower bandwidth (it takes a lot of
resources to stay connected to the data continuously). With ADO, you
can invoke a sql server stored procedure, retrieve the data and then
close the connection. Here is a sample of ado for getting data from a
sql server sp - invoked from a standard module in an Access97 mdb:
Sub GetdataFromSqlSrv()
Dim cmd As New ADODB.Command, conn As New ADODB.Connection
Dim RSado As New ADODB.Recordset, RSdao As DAO.Recordset
Dim i As Long, j As Long, k As Integer, RetVal As Variant
Dim eDate As Date, sDate As Date, d as date
Dim sTim As Single, eTim As Single, totTim As Single
sTim = Timer
cmd.ActiveConnection="Provider=SQLOLEDB;Data Source=srv1;" _
& "Initial Catalog=myDB;UID=SA;PWD=abc;"
cmd.CommandTimeout = 600
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "stp_GetData"
d = #1/1/2004#
sDate = Month(d) & "/1/" & Year(d)
eDate = DateAdd("m", 1, sDate) - 1 'get one month of data
cmd.Parameters("@bDate").Value = sDate
cmd.Parameters("@eDate").Value = eDate
Set RSado = cmd.Execute
Set RSdao = CurrentDb.OpenRecordset("tbl1")
DoEvents
Do While Not RSado.EOF
RSdao.AddNew
For i = 0 To RSado.Fields.Count - 1
RSdao(i) = RSado(i) 'copy data from each field
Next
RSdao.Update 'update dao recordset
RSado.MoveNext
Loop
cmd.ActiveConnection.Close 'close ado connection
eTim = Timer
totTim = eTim - sTim
totTim = (eTim - sTim) / 60 'get time in minutes
RetVal = SysCmd(acSysCmdSetStatus, "Total Time is " & totTim & " minutes
Or Total Time is " & totTim * 60 & " seconds")
End Sub
Rich
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!