我是VBA編程的新手。我設計了一個有按鈕的表單。點擊這個按鈕後,我想在我的表格中插入有一個日期列的記錄。虛擬記錄的數量應該等於當月的天數。如果月是2016年5月,那麼記錄將插入日期1/5/2016, 2/5/2016 ....... 31/5/2016那樣。使用VBA在Access表中插入當前月份的每個日期記錄
在此先感謝。
Private Sub Command0_Click()
Dim strQuery As String
Dim currDateTime As Date
currDateTime = Now()
strQuery = "INSERT INTO tbl_ShipOrders (IDate) VALUES (" & currDateTime & ")"
CurrentDb.Execute (strQuery)
End Sub
使用'for ... next'循環。 –