Eof

I

idsck

hi Guys,
I am new to VBA. Hope to get help here.
I am trying to import data from Access to Word by using word'
bookmark/Dot file. Anyhow, it did put all the data/Rows to Word, but i
all stick together. My question is how do I seperate those data . Th
Code that I used as below. Thanks in advance

Dim rsMyRS As Recordset
Set rsMyRS = Me.Tsubform2.Form.Recordset
Dim objWord9 As Object
Set objWord9 = CreateObject("Word.Application")
objWord9.Documents.Add _
Application.CurrentProject.Path & "\Notes.dot"
objWord9.Visible = True
If Not rsMyRS.EOF Then rsMyRS.MoveFirst
Do While Not rsMyRS.EOF
With objWord9.ActiveDocument.Bookmarks
.Item("DATE").Range.Text = Format(Forms!Tform!Tsubform2!DATE)
.Item("NOTES").Range.Text = Forms!Tform!Tsubform2!NOTES
rsMyRS.MoveNext
End With
Loo
 
J

jl5000

Try adding (chr(13)+chr(10)) to this line

..Item("NOTES").Range.Text = Forms!Tform!Tsubform2!NOTES & (chr(13)+chr(10))

This will add a return and skip a line
 
M

Michael Miller

just FYI, vb has its own built in variable to cover a carriage return, line
feed, which is vbCRLF, so you'd say & vbCRLF <case is insignificant>. I
think you can use it in your context

I use it all the time in Access message boxes,

msgBox "You have made a boo boo!" + vbCRLF + "Make sure you have your brain
engaged before setting your hands in motion."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top