假设你的表为《10月段考》,则下列程序可实现插入空白行,结果在《表3》:
Dim db As Database
Dim rst As Recordset
Dim sql1 As String
DoCmd.SetWarnings False
DoCmd.RunSQL ("alter table 10月段考 add column ID autoincrement primary key")
DoCmd.RunSQL ("select * into 表2 from 10月段考 where 1<>1")
DoCmd.RunSQL ("select * into 表3 from 10月段考 where 1<>1")
Set db = CurrentDb
Set rst = db.OpenRecordset("表2")
rst.AddNew
rst.Update
rst.Close
i = 1
n = DCount("*", "10月段考")
Set rst = db.OpenRecordset("10月段考")
Do While i <= n
sql1 = "insert into 表3 select * from 10月段考 where ID="
sql1 = sql1 & i
DoCmd.RunSQL (sql1)
DoCmd.RunSQL ("insert into 表3 select top 1 * from 表2")
i = i + 1
Loop
DoCmd.SetWarnings True