更新時のフォームのちらつき

解決


 2005-11-03 16:53:49  No: 92419  IP: [192.*.*.*]

開発環境:ACCESS2003、WindowsXP
ACCESSのフォームからDDEでEXCELのデータを取得し、テーブルへ入れた後、フォームを更新させると、画面がちらつくのですが、ちらつかない方法はあるでしょうか?よろしくお願いします。

Private Sub command_Click()
 Dim ch1 As Long
 Dim ch2 As Long
 Dim strExcelPath As String
 Dim strExcelSheet As String
 Dim strFilePath As String
 Dim i As Integer
 Dim j As Integer
 Dim celData As Variant
 Dim cn As New ADODB.Connection
 Dim rs As New ADODB.Recordset
 Dim tableName As String
 
 Set cn = CurrentProject.Connection
 tableName = "****"
 rs.Open tableName, cn, adOpenKeyset, adLockOptimistic
 strExcelPath = "****"
 strExcelSheet = "****"
 strFilePath = "****"
 Shell strExcelPath, 1
 ch1 = DDEInitiate("Excel", "System")
 DDEExecute ch1, "[open(""" & strFilePath & """)]"
 ch2 = DDEInitiate("Excel", strExcelSheet)
 celData = DDERequest(ch2, "R1C1")
 rs.AddNew
 rs.Fields(0) = celData
 rs.Update     
 DDETerminate ch1
 DDETerminate ch2
 Me.Refresh
End Sub

編集 削除
 2005-11-04 09:10:49  No: 92420  IP: [192.*.*.*]

すくりーんあっぷでーでぃんぐをふぉるすにする

編集 削除
M  2005-11-04 13:15:12  No: 92421  IP: [192.*.*.*]

。さんコメントありがとうございます。
Application.ScreenUpdating = False は
ExcelVBAでは使えますが、AccessVBAでは使えません。

編集 削除
M  2005-11-05 23:16:26  No: 92422  IP: [192.*.*.*]

あまり使いたくはなかったのですが
Repaint メソッド使って、更新時のちらつきを抑えました。
一応解決とします。

編集 削除