I am trying to create a DB that fixes some common data problems in a DB created by an app purchased by my employer.
I need to check one field of a table and make multiple alterations. I have tried the following code but am getting an improper use of null error when the code is running.
This is the first of many different replaces I have to do on the records in the comments field. (for checking school report comments)
I know once I get this working I will be able to complete all the checks I would normally do manually (just opening the TABLE in access and runnig find/replace a number of times) but I am going on leave and others are going to have to check this information so I am trying to make it easier as most of the other staff at my work wouldn't have a clue when it comes to access.
Any help would be greatly appreciated.
Thanks
Jubb
PS. I have also tried using an If isnull(rs1!comments) then... in the loop but that causes another problem. Also I am using link tables to access the main DB.
I need to check one field of a table and make multiple alterations. I have tried the following code but am getting an improper use of null error when the code is running.
Code:
Private Sub cmdReplacer_Click()
Dim rs1 As Recordset
Set rs1 = CurrentDb.OpenRecordset("Grades")
rs1.MoveFirst
While Not rs1.EOF
rs1.Edit
rs1!Comments = Replace(rs1!Comments, "co-oper", "cooper")
rs1.Update
rs1.MoveNext
Wend
MsgBox "All instances of co-oper changed to cooper", vbOKOnly, "Check 1 complete"
rs1.Close
End Sub
This is the first of many different replaces I have to do on the records in the comments field. (for checking school report comments)
I know once I get this working I will be able to complete all the checks I would normally do manually (just opening the TABLE in access and runnig find/replace a number of times) but I am going on leave and others are going to have to check this information so I am trying to make it easier as most of the other staff at my work wouldn't have a clue when it comes to access.
Any help would be greatly appreciated.
Thanks
Jubb
PS. I have also tried using an If isnull(rs1!comments) then... in the loop but that causes another problem. Also I am using link tables to access the main DB.