Accessing Dataview Entry After Each Merge Event

I am doing a mailmerge with a Dataview. I also use the HandleMergeField event handler to do some character manipulation before the merge of each field onto the letter. Works good.....

Now, I need to get to the column values of each Dataview entry after the merge for each dataview entry. The reason for this is that I want to do an SQL Update back to my server once the letter is merged...one letter at a time. The problem is that the HandleMergeField only gets passed fields that are defined on the document. The fields I need are in the Dataview and NOT defined on the document.

Any ideas, help, or suggestions????

Confused [*-)]

Please make a more detailed description of your task. I do not quite get what are you up to.

I have created a letter generation system that works as follows:

1) Data records in a table are created on the server.

2) User invokes a client VB.net application that selects the data records created in step (1) and loads these records into a Datagrid.

3) User can select the records he/she wishes to mailmerge by selecting a checkbox field I have added to the Datagrid/Dataset.

4) I create a Dataview object based on the Datagrid Dataset and select only checkbox fields = true.

5) Mailmerge Dataview created in step (4) to my document.

6) Update the server data records as already having been printed so they are not loaded into the Datagrid again.

Everything basically work up to this point......

What I wanted to do is update each record on the server as having already been printed as I mailmerge each data record. Microsoft has a few MailMerge methods defined before and after the mailmerge of each record. I am using the HandleMergeField method to, basically, catch each record - that works fine.

The problem is that the HandleMergeField is only passed fields that are defined on the document. The key fields I need to achieve an SQL UPDATE are not required and don't make sense on the document. But, they are in the Dataview which is the source of the mailmerge. I want access to these entries while I am mailmerging each record.

Is there any mechanism I can use to do this?

Thank you.

Have you tried MergeFieldEventArgsBase.RecordIndex property. It will point to the currently executing row of the merged data source - DataView in your case? You can pick and update this row, including fields that are not used in merging.

Well, I did try to use that, in a way. What I tried to do was use the .recordindex property to get back to the Dataset which is the source of the Dataview. I am not sure why I did not use this to get back to the Dataview instead of the Dataset. I guess I was thinking that I did not want to interfere with any sequential I/O processing of the Dataview since it is used for the mailmergeā€¦