Inserting Weekends into Table with only Weekdays MS Access

后端 未结 2 469
遥遥无期
遥遥无期 2021-01-25 08:10

I\'m needing to insert the weekends into a table that only has weekdays and then assign the last known value to the weekend values. I know I\'m going to need an Insert Query, al

2条回答
  •  执笔经年
    2021-01-25 08:43

    When entering dates as query criteria, enclose them in pound signs (#)

    DoCmd.RunSQL "INSERT INTO Archive SELECT * FROM Archive WHERE ValDate = #" & DateVal & "#"
    

    Edited 1

    Do While Not rs.EOF
             If IsNull(DLookup("ValDate", "Archive", "ValDate=#" & DateAdd("d", 1, ValDate) & "#")) = True Then
            rs.AddNew
            rs![ValDate] = DateVal
            rs.Update
        End If
        rs.MoveNext
    Loop
    

提交回复
热议问题