title: Access change memo field from "plain text" to "rich text" using VBScript
body: <p>i have a question about changing a memofield from "plain text" to "rich text" using VBScript, i found some solutions here and on the internet but all the solutions are for VBScript within access. I try to start an vbscript through Windows, but my script doesn't work. I'm kindly new to VBScripting so i hope you guys can help me. I used an example from the forum for my script:
  <a href="https://stackoverflow.com/questions/20828561/how-to-convert-a-text-field-in-an-access-table-to-a-rich-text-memo-using-vba">How to convert a text field in an Access table to a rich text memo using VBA</a></p>
  
  <p>My Script:</p>
  
  <pre><code>Dim db
  Dim tdf
  Dim fld1
  Dim fld2
  Set accessApp = GetObject("D:\test.mdb")
  Set accessApp = CreateObject("Access.Application")
      accessApp.OpenCurrentDataBase "D:\test.mdb", true
      accessApp.visible = false
      accessApp.UserControl = true 
  
  Set accessApp.db =  CurrentDB
  Set accessApp.tdf = db.TableDefs("Database")
  Set accessApp.fld1 = tdf.Fields("Name_Memofield1")
  Set accessApp.fld2 = tdf.Fields("Name_Memofield2")
  Debug.Print "acTextFormatPlain: " &amp; acTextFormatPlain &amp; _
      "; acTextFormatHTMLRichText: " &amp; acTextFormatHTMLRichText
  With fld1.Properties("TextFormat")
      Debug.Print "TextFormat: " &amp; .Value
      If .Value = acTextFormatPlain Then
          .Value = acTextFormatHTMLRichText
          Debug.Print "TextFormat changed to: " &amp; .Value
      End If
  End With    
  With fld2.Properties("TextFormat")
      Debug.Print "TextFormat: " &amp; .Value
      If .Value = acTextFormatPlain Then
          .Value = acTextFormatHTMLRichText
          Debug.Print "TextFormat changed to: " &amp; .Value
      End If
  End With
  </code></pre>
  
  <p>The error what occures tells me that the problem is in the "Set accessApp.db =  CurrentDB" the error which occured is: "Object doesn't support this prperty or method accessApp.db" If i change "accessApp.db" to "db" an other error occures: "Object required: 'CurrentDB' " </p>