Hi,

I think I am a very confused programmer because I can't find what's wrong here. Here's my code:
VB Code:
  1. With RsDependents
  2.         Dim i As Byte
  3.         If .RecordCount > 0 Then
  4.             .MoveLast
  5.             While .BOF = False
  6.                 If .Fields("EmpCode") = RsPersonalData.Fields("EmpCode") Then
  7.                     .Delete
  8.                 End If
  9.                 .MovePrevious
  10.             Wend
  11.             .Update
  12.         End If
  13.         .Close
  14.         .Open
  15.         For i = 1 To mfgDependents.Rows - 1
  16.             .AddNew
  17.             .Fields("EmpCode") = RsPersonalData.Fields("EmpCode")
  18.             .Fields("Name") = StrConv(mfgDependents.TextMatrix(i, 1), vbProperCase)
  19.             .Fields("Age") = Val(mfgDependents.TextMatrix(i, 2))
  20.             .Fields("Relationship") = StrConv(mfgDependents.TextMatrix(i, 3), vbProperCase)
  21.             .Fields("Address") = StrConv(mfgDependents.TextMatrix(i, 4), vbProperCase)
  22.             .Update
  23.         Next i
  24.     End With

It's supposed to delete the contents of a table who's empcode is the same as the empcode on another table, and afterwards add the entire contents of a flexgrid to it. Heres the problem;
everytime this code runs, i get an error message "Error occured" and then vb highlights the line next to .Addnew. Can anyone help me here?

Also, does anyone know how i can add a new page to a word document using vb and afterwards, edit certain portions of it?