A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Recordset merge



 
 
Thread Tools Display Modes
  #1  
Old March 15th, 2010, 08:10 PM posted to microsoft.public.access
Scafidel[_3_]
external usenet poster
 
Posts: 11
Default Recordset merge

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
  #2  
Old March 26th, 2010, 06:17 PM posted to microsoft.public.access
Scafidel[_3_]
external usenet poster
 
Posts: 11
Default Recordset merge

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

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:33 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.