Prev: ciao riccardo
Next: Switchboard in Access 2010
From: Scafidel on 15 Mar 2010 15:10 I am merging from an Access 2007 Form/subforms to a bookmarked Word document. I am able to use <.MoveNext> to merge the recordsets, but get an error if there are less records. The DAO Library is referenced, I've tried this code, but now only the first record is merged and the fields of the recordsets of the form are replaced with #Name? (Fortunately, rebooting Access returns the recordset fields to former state). Any suggestions? Dim db As DAO.Database Dim rs As DAO.Recordset Set db = CurrentDb Set rs = Forms("OGML").qryMineralOwnersub.Form.Recordset rs.MoveFirst InsertAtBookmarks objWord, objDoc, "Owners1", rs!MineralOwner If Not (rs.BOF And rs.EOF) Then GoTo Exit_here rs.MoveNext End If InsertAtBookmarks objWord, objDoc, "Owners2", rs!MineralOwner -- Lafayette, LA
From: Scafidel on 26 Mar 2010 13:17 I found it. I was closing my RS twice. Remarked one out and it runs good. Thanks for looking. -- Lafayette, LA "Scafidel" wrote: > I am merging from an Access 2007 Form/subforms to a bookmarked Word document. > I am able to use <.MoveNext> to merge the recordsets, but get an error if > there are less records. > The DAO Library is referenced, I've tried this code, but now only the first > record is merged and the fields of the recordsets of the form are replaced > with #Name? (Fortunately, rebooting Access returns the recordset fields to > former state). Any suggestions? > > Dim db As DAO.Database > Dim rs As DAO.Recordset > Set db = CurrentDb > Set rs = Forms("OGML").qryMineralOwnersub.Form.Recordset > > rs.MoveFirst > InsertAtBookmarks objWord, objDoc, "Owners1", rs!MineralOwner > > If Not (rs.BOF And rs.EOF) Then > GoTo Exit_here > rs.MoveNext > End If > InsertAtBookmarks objWord, objDoc, "Owners2", rs!MineralOwner > -- > Lafayette, LA
|
Pages: 1 Prev: ciao riccardo Next: Switchboard in Access 2010 |