this is the code I used:
Code:
Dim strDocName As String
Dim appWord As Word.Application
Dim doc As Word.Document
Dim docTable As Table
Dim iRow As Long
Dim sSQL As String
Dim sValue As String
Dim db
'in case of problems: whether Word document is open, is correct format etc.
'On Error GoTo ErrorHandling
strDocName = CurrentProject.Path & cstrFolder & strFileName
Set appWord = CreateObject("Word.Application")
Set doc = appWord.Documents.Open(strDocName)
For Each docTable In doc.Tables
sSQL = "INSERT INTO tblNewStudents (fldStudentNo, fldFirstName, fldLastName, fldTelephone) VALUES ("
For iRow = 2 To docTable.Rows.Count
sValue = Trim(docTable.Cell(iRow, 2).Range.Text)
sSQL = sSQL & "'" & Left(sValue, Len(sValue) - 2) & "',"
Next iRow
sSQL = Left(sSQL, Len(sSQL) - 1) & ")"
Debug.Print sSQL
Set db = CurrentDb
db.Execute sSQL
Set db = Nothing
Next docTable
doc.Close
Set doc = Nothing
Set appWord = Nothing
You can add whatever you want but if you're trying to load one document at a time that may be tedious and you can cycle through all files in a specific folder to do what you want as well using fileystemobject commands.