For i = 1 To DateDiff("d", Me.开始日期, Me.结束日期)
DoCmd.RunSQL "insert into Tb_日历(日期,星期) values('" & Me.开始日期 & "'+" & i & " ,weekday('" & Me.开始日期 & "'+" & i & "))"
Next
以为解决了,当i运行至10时,还是出现错误
我的代码是这样的:
For i = 1 To DateDiff("d", Me.开始日期, Me.结束日期)
DoCmd.RunSQL "insert into Tb_日历(日期,星期) values('" & Me.开始日期 & "'+'" & i & "' ,WeekdayName(weekday('" & Me.开始日期 & "'+'" & i & "')))"
Next