Another Subroutine
Paste the following into a standard module:
Code:
Sub AddCodes()
Dim i As Integer
Dim EquipPrefix As String
Dim sSQL As String
Dim YourTableName As String
Dim YourFieldName As String
'=========================
'Change these to ythe actual table name
EquipPrefix = "MR" '<<<--- Change this to the code you want (MR, PC, ...)
YourTableName = "tblAssign" '<<<--- Change this to the actual TABLE name
YourFieldName = "DriverName" '<<<--- Change this to the actual FIELD name
'=========================
For i = 1 To 100
sSQL = "INSERT INTO " & YourTableName & " (" & YourFieldName & ")"
sSQL = sSQL & " VALUES ('" & EquipPrefix & Format(i, "000") & "')"
'Debug.Print sSQL
CurrentDb.Execute sSQL, dbFailOnError
Next
MsgBox "Done"
End Sub