R
Ramon Janmaat
Hi,
I am using the same Access (2000) database, with ODBC connections to a
MySQL server, on windows xp and 2k machines where the following code
is on the xp machines extremely slow. The movelast action takes no
time on the 2k machines, on the xp machine it takes at least 5
seconds. Creating a recordset from a querydefinition takes about the
same time on both machines. The debug results are just an example, on
the whole system it slows up to minutes. The movelast/first takes a
lot more time on older win xp machines.
Here is the code and the debug results:
Function StatischeRecordset(strSql As String, Optional intType As
RecordsetTypeEnum = dbOpenDynaset) As Recordset
Dim qdfQuery As QueryDef
Dim parItem As Parameter
Dim rstRecordset As Recordset
If Left(strSql, 3) = "qry" Then
Set qdfQuery = CurrentDb.QueryDefs(strSql)
Else
If Not Left(strSql, 6) = "SELECT" Then strSql = "SELECT * FROM
" & strSql
Set qdfQuery = CurrentDb.CreateQueryDef("", strSql)
End If
For Each parItem In qdfQuery.Parameters
parItem.Value = Eval(parItem.Name)
Next
Debug.Print " recordset start: " & Now
Set rstRecordset = qdfQuery.OpenRecordset(intType)
Debug.Print " recordset a : " & Now
If Not bnRecordsetLadenOud Then
Call rstRecordset.MoveLast
Call rstRecordset.MoveFirst
End If
Debug.Print " recordset b : " & Now
Set StatischeRecordset = rstRecordset
Debug.Print " recordset end : " & Now
End Function
Debug in Windows XP:
recordset start: 23-11-2004 19:21:34
recordset a : 23-11-2004 19:21:37
recordset b : 23-11-2004 19:21:41
recordset end : 23-11-2004 19:21:41
Debug in Windows 2K:
recordset start: 23-11-2004 19:21:34
recordset a : 23-11-2004 19:21:37
recordset b : 23-11-2004 19:21:37
recordset end : 23-11-2004 19:21:37
Thanks in advance!
Ramon Janmaat
I am using the same Access (2000) database, with ODBC connections to a
MySQL server, on windows xp and 2k machines where the following code
is on the xp machines extremely slow. The movelast action takes no
time on the 2k machines, on the xp machine it takes at least 5
seconds. Creating a recordset from a querydefinition takes about the
same time on both machines. The debug results are just an example, on
the whole system it slows up to minutes. The movelast/first takes a
lot more time on older win xp machines.
Here is the code and the debug results:
Function StatischeRecordset(strSql As String, Optional intType As
RecordsetTypeEnum = dbOpenDynaset) As Recordset
Dim qdfQuery As QueryDef
Dim parItem As Parameter
Dim rstRecordset As Recordset
If Left(strSql, 3) = "qry" Then
Set qdfQuery = CurrentDb.QueryDefs(strSql)
Else
If Not Left(strSql, 6) = "SELECT" Then strSql = "SELECT * FROM
" & strSql
Set qdfQuery = CurrentDb.CreateQueryDef("", strSql)
End If
For Each parItem In qdfQuery.Parameters
parItem.Value = Eval(parItem.Name)
Next
Debug.Print " recordset start: " & Now
Set rstRecordset = qdfQuery.OpenRecordset(intType)
Debug.Print " recordset a : " & Now
If Not bnRecordsetLadenOud Then
Call rstRecordset.MoveLast
Call rstRecordset.MoveFirst
End If
Debug.Print " recordset b : " & Now
Set StatischeRecordset = rstRecordset
Debug.Print " recordset end : " & Now
End Function
Debug in Windows XP:
recordset start: 23-11-2004 19:21:34
recordset a : 23-11-2004 19:21:37
recordset b : 23-11-2004 19:21:41
recordset end : 23-11-2004 19:21:41
Debug in Windows 2K:
recordset start: 23-11-2004 19:21:34
recordset a : 23-11-2004 19:21:37
recordset b : 23-11-2004 19:21:37
recordset end : 23-11-2004 19:21:37
Thanks in advance!
Ramon Janmaat