"Type Mismatch" error message when you run a VBA macro in a 64-bit version of an Office 2010 application http://support.microsoft.com/kb/983246
RecordCount(ADO)の値Typeの件。Win7に限らず、offce2010(64bit)で影響するから、まぁXPは少ないだろうけど、64bitOS(Vista/Server2008とか)全部関係するでしょうな。
Option Compare Database
Option Explicit
Sub ADOtest()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Set cn = Application.CurrentProject.AccessConnection
rs.CursorLocation = adUseClient
rs.Open "select * from table01", cn, adOpenKeyset, adLockOptimistic
Debug.Print rs.RecordCount, TypeName(rs.RecordCount)
rs.Close: Set rs = Nothing
cn.Close: Set cn = Nothing
End Sub
'Win7の場合、rs.RecordCountは、Longlong → Win7SP1の場合、Long
Sub DAOtest()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("select * from table01")
rs.MoveLast
Debug.Print rs.RecordCount, TypeName(rs.RecordCount)
Set db = Nothing
End Sub
'Win7/Win7SP1変わらず、Long
ADO関係のファイルバージョンが、6.1.7601.17105に。その他accessに関係しそうなのが、
A computer that is running Windows 7 or Windows Server 2008 R2 takes four minutes to open a Microsoft Office 2003 document from a network share http://support.microsoft.com/kb/982860
4分かかるて、、、。Win7混じるとa2003が遅いって話しあったけどこれなのかな。
0 件のコメント:
コメントを投稿