I am using the VBA below to try to update the FirstName, LastName and MiddleName to a table. Everything seems to be working except when I try to write the string values to the record set.
Any ideas why this is not working?
Any ideas why this is not working?
Code:
Option Compare Database
Private Sub parseNames()
Dim dbs
Dim qdf
Dim rst
Dim firstName as String
Dim lastName as String
Dim midName as String
Set db = CurrentDb()
Set qdf = db.QueryDefs("NameParse")
Set rst = qdf.OpenRecordset()
If Not (rst.EOF And rst.BOF) Then
rst.MoveFirst
Do Until rst.EOF = True
rst.Edit
emailName = rst("Email Name")
If emailName <> "" Then
'here I am doing some work to parse out first, last and middle names from email addresses
End If
firstName = Trim(firstName)
lastName = Trim(lastName)
midName = Trim(midName)
[B] rst.FirstName.Value = firstName[/B]
[B] rst.LastName.Value = lastName[/B]
[B] rst.MiddleName.Value = midName[/B]
rst.MoveNext
Loop
End If
End Sub