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
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme