Please read this everyone. (Especially you, Martin Liss)
Hi,
I think I am a very confused programmer because I can't find what's wrong here. Here's my code:
VB Code:
With RsDependents
Dim i As Byte
If .RecordCount > 0 Then
.MoveLast
While .BOF = False
If .Fields("EmpCode") = RsPersonalData.Fields("EmpCode") Then
.Delete
End If
.MovePrevious
Wend
.Update
End If
.Close
.Open
For i = 1 To mfgDependents.Rows - 1
.AddNew
.Fields("EmpCode") = RsPersonalData.Fields("EmpCode")
.Fields("Name") = StrConv(mfgDependents.TextMatrix(i, 1), vbProperCase)
.Fields("Age") = Val(mfgDependents.TextMatrix(i, 2))
.Fields("Relationship") = StrConv(mfgDependents.TextMatrix(i, 3), vbProperCase)
.Fields("Address") = StrConv(mfgDependents.TextMatrix(i, 4), vbProperCase)
.Update
Next i
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?