C
Chris Hayes
I'm trying to weed out Middle names out of first names in a db
Here's the code:
Private Sub Command0_Click()
Dim rstEmployees As ADODB.Recordset
Dim strSQL As String
Set conDatabase = CurrentProject.Connection
strSQL = "SELECT * FROM Contacts WHERE firstname LIKE '% " & txtReplace
& ".'"
Set rstEmployees = New Recordset
rstEmployees.Open strSQL, conDatabase, adOpenDynamic, adLockOptimistic
With rstEmployees
Do While Not .EOF
!MiddleName = txtReplace & "."
.Update
.MoveNext
Loop
End With
MsgBox "The Middle Initial" & txtNewMinSalary & "has been moved to the
MiddleName Field"
rstEmployees.Close
conDatabase.Close
Set rstEmployees = Nothing
Set conDatabase = Nothing
End Sub
Says "Invalid use of "new" keyword"
Anyone?
--
Chris Hayes
Still a beginner (only 12 years)
[fyi, you can email me by getting rid of the British Comedian''s name who
wrote that song about "Spam"]
Here's the code:
Private Sub Command0_Click()
Dim rstEmployees As ADODB.Recordset
Dim strSQL As String
Set conDatabase = CurrentProject.Connection
strSQL = "SELECT * FROM Contacts WHERE firstname LIKE '% " & txtReplace
& ".'"
Set rstEmployees = New Recordset
rstEmployees.Open strSQL, conDatabase, adOpenDynamic, adLockOptimistic
With rstEmployees
Do While Not .EOF
!MiddleName = txtReplace & "."
.Update
.MoveNext
Loop
End With
MsgBox "The Middle Initial" & txtNewMinSalary & "has been moved to the
MiddleName Field"
rstEmployees.Close
conDatabase.Close
Set rstEmployees = Nothing
Set conDatabase = Nothing
End Sub
Says "Invalid use of "new" keyword"
Anyone?
--
Chris Hayes
Still a beginner (only 12 years)
[fyi, you can email me by getting rid of the British Comedian''s name who
wrote that song about "Spam"]