Change of Thought

A few days ago I disparaged MS Access with its grip on my data. After relieving my mind of those thoughts I realized the problem is not the program, or its capabilities, rather the problem is with me

To explore this I opened my data in MS Access and proceeded to write a VBA subroutine that removed linefeeds from the memo fields. Not the most elegent, but it did the job:

Sub RemoveFeeds()
  Dim db As Database
  Dim rs As Recordset
  Dim qry As QueryDef
  Dim msg As String
  Dim id As Integer

  Debug.Print
  Debug.Print "Start: " & Now

  Set db = CurrentDb
  Set rs = db.OpenRecordset("TestTable", dbOpenTable)
  While Not rs.EOF
    rs.Edit
    msg = Replace(CStr(RTrim(rs.Fields("Message"))), vbLf, "")
    msg = Replace(msg, """", "'")
    id = rs.Fields("[MID]")
    rs.Fields("Message") = msg
    rs.Update
    rs.MoveNext
  Wend
  Debug.Print "End: " & Now
  MsgBox "Complete!"
  rs.Close
End Sub

What I especially liked was the speed of the code. There are over 15000 entries, each entry having several paragraphs of text. VBA blazed through all of it in under 60 seconds.

That little demonstation encouraged me to perform the rest of the work within MS Access. The data still needs migrated to MySQL, in a specific format, but I will do the formatting work in Access. Silly me letting pride and emotion interfere.

UPDATE (2004/2/3): changed <code> to <pre>

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

Comments are closed.