If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#2
|
|||
|
|||
Importing data into a MEMO field
"RoMi" wrote in
: How do you import an arranged text into a memo/field where `arranged text` means the text with the several paragraphs, i.e. the text split into several rows by the ENTER command. Assume that we have such arranged text in 2-3 columns and 100+ row table made by MS Word (2002). I would probably do all this in Word VBA rather than Access, because the database stuff is the easy part and getting the text out of the table cells will be harder. I suggest you check the m.p.word.vba.general for good Word vba web sites and help. In short it would be something like this: I haven't really explored programming with Tables in Word, so make sure you check out the object model properly! ' database access: this is all that Access ' does for you Set dbEngine = CreateObject("DAO.DBEngine") Set db = dbEngine.OpenDatabase("d:\MyDatabase.mdb") ' now go through the table For each cel in ThisDocument.Tables(1).Cells ' make a command. You will have to be responsible ' for handling any problematic characters in the text: - ' the most likely one will be a double-quote strSQL = "INSERT INTO MyTable (MemoField) " & _ "VALUES (""" & cel.Range.Text & """)" ' carry out the command. You should really catch any ' errors with an On Error .... line db.Execute strSQL, dbFailOnError ' if all was okay, get the next table cell Next cel ' tidy up afterwards db.Close Hope that helps Tim F |
Thread Tools | |
Display Modes | |
|
|