0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

sharepointListに接続してレコードを追加する。

Last updated at Posted at 2024-07-30
Sub AddRecordToSharePointList()
    Dim db As DAO.Database
    Dim rst As DAO.Recordset
    Dim strUser As String
    
    ' 現在のユーザー名を取得
    strUser = Environ("USERNAME")
    
    ' SharePointリストに接続
    Set db = CurrentDb()
    Set rst = db.OpenRecordset("LinkedSharePointList")
    
    ' 新しいレコードを追加
    With rst
        .AddNew
        ![ColumnName1] = "Value1" ' カラム名と値を適宜変更
        ![ColumnName2] = "Value2" ' カラム名と値を適宜変更
        ![Timestamp] = Now ' 現在の時刻を追加
        ![AddedBy] = strUser ' 現在のユーザー名を追加
        .Update
    End With
    
    ' レコードセットを閉じる
    rst.Close
    Set rst = Nothing
    Set db = Nothing
End Sub
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?