Objective: I want to be able to assign initials to records in an alternating method until I run out of records.
For example, I have 451 records I would like to do the following:
1.TP
2.DM
3.PW
4.TP
5.DM
...
451.TP
Thanks in advance for any advice.
For example, I have 451 records I would like to do the following:
1.TP
2.DM
3.PW
4.TP
5.DM
...
451.TP
Thanks in advance for any advice.
Code:
Sub SOSAssign()
Dim dbs As Database
Dim rst As Recordset
Dim Counter As Integer
' set up a updateable recordset of table
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT * FROM Table_Master", dbOpenDynaset)
' find number of records in recordset
Counter = rst.RecordCount
' loop until run out of records
Do Until Counter = 0
With rst
' sets the SOS field to Thor Pio
!SOS = TP
' moves to next record
rst.MoveNext
' one less record to go
Counter = Counter - 1
With rst
' sets the SOS field to Dido Maximus
!SOS = DM
' moves to next record
rst.MoveNext
' one less record to go
Counter = Counter - 1
With rst
' sets the SOS field to Party Willy
!SOS = PW
' moves to next record
rst.MoveNext
' one less record to go
Counter = Counter - 1
' loop until run out of records
Loop
End Sub