テーブルの操作

Last-modified: 2022-10-29 (土) 22:02:48

テーブルにレコードを追加する

    Dim lngId As Long
    Dim strSql As String
    Dim datStartTime As Date

    datStartTime = Now

    For lngId = 1 To 1000000
        strSql = ""
        strSql = strSql & "INSERT " & vbCrLf
        strSql = strSql & "INTO " & vbCrLf
        strSql = strSql & "  テーブル1 " & vbCrLf
        strSql = strSql & "VALUES " & vbCrLf
        strSql = strSql & "( " & vbCrLf
        strSql = strSql & "   'lngId' " & vbCrLf
        strSql = strSql & "  ,'値2' " & vbCrLf
        strSql = strSql & "  ,'値3' " & vbCrLf
        strSql = strSql & "); " & vbCrLf

        CurrentDb.Execute strSql

    Next

    Debug.Print Format(Now - datStartTime)