0

我需要查询,通过它我可以生成从 1 开始并以任何给定数字结束的新记录。

我有一个桌子座位。在这张表中,我只有一个字段 seat_no。我需要从 1 到任何所需数字的座位号。

所以请任何帮助....

4

1 回答 1

0

You need to use some kind of loop for this. To do the inserts you could use a DAO recordset or else use the CurrentDb.Execute method as show below:

Public Function AddSeats(lMax as Long)
    Dim l as Long
    l = 1
    Do Until l = (lMax + 1)
        CurrentDb.Execute "INSERT INTO TableName (seat_no) VALUES (" & l & ")", dbFailOnError
        l = l + 1
    Loop
End Function
于 2013-08-31T14:12:39.593 回答