marcuscoker
Registered User.
- Local time
- Yesterday, 16:47
- Joined
- Sep 28, 2005
- Messages
- 49
Hi I have the following problem
I have written a script that i want to loop through a recordset. Everytime the script finds a blank in the firstname column, to take the value of the previous firstname and populate it with that, but the script does not appear to be working can anybody help me?
Sub EditRecords()
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("WHO ENTERED THE DUPLICATE")
rs.MoveFirst
Do While Not rs.EOF
'store last surname in variable
Dim sFirstName, SFirstNameStored
sFirstName = rs!Firstname
If sFirstName <> "" Then
SFirstNameStored = sFirstName
End If
If sFirstName = "" Then
sFirstName = SFirstNameStored
End If
rs.Edit
rs!Firstname = UCase$(rs!Firstname)
rs.Update
rs.MoveNext
Loop
rs.Close
End Sub
I have written a script that i want to loop through a recordset. Everytime the script finds a blank in the firstname column, to take the value of the previous firstname and populate it with that, but the script does not appear to be working can anybody help me?
Sub EditRecords()
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("WHO ENTERED THE DUPLICATE")
rs.MoveFirst
Do While Not rs.EOF
'store last surname in variable
Dim sFirstName, SFirstNameStored
sFirstName = rs!Firstname
If sFirstName <> "" Then
SFirstNameStored = sFirstName
End If
If sFirstName = "" Then
sFirstName = SFirstNameStored
End If
rs.Edit
rs!Firstname = UCase$(rs!Firstname)
rs.Update
rs.MoveNext
Loop
rs.Close
End Sub