Add numbers 1-639

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hi experts, can anyone tell me how to populate a number
field with the numbers 1 thru 639? Obviously, this will be
sequential like an autonumber but I already have a random
autonumber field. I'm pretty sure I start with an update
query.... but then what? Thank you

Mike
City of San Diego
 
Function MakeData()
Dim rs As DAO.Recordset
Dim lng As Long

Set rs = DBEngine(0)(0).OpenRecordset("MyTable")

For lng = 1 To 639
rs.AddNew
rs![MyField] = lng
rs.Update
Next

rs.Close
Set rs = Nothing
End Function
 
Hi experts, can anyone tell me how to populate a number
field with the numbers 1 thru 639? Obviously, this will be
sequential like an autonumber but I already have a random
autonumber field. I'm pretty sure I start with an update
query.... but then what? Thank you

Mike
City of San Diego

I pretty routinely put a general-purpose table Num in every database,
with a single field N with values 0-65535. I just copy it from a
previous database now, but IIRC the first time I built it I just used
fill-down in Excel and imported.

An Append or Update query using Num and a criterion of <639 would do
this if you had such a table.
 
Back
Top