Hi all,
I would like to have all my data sent to a microsoft word file from a continuous subform.
At this moment I can only send one record.
This is my code below:
Private Sub Command143_Click()
On Error GoTo markerr:
Dim objWord As Word.Application
Set objWord = CreateObject("Word.application")
With objWord
.Visible = True
.Documents.Open ("Y:\Mark\Vendor's Database\PO\GAMEPO.doc")
.ActiveDocument.Bookmarks("PO").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![PO]))
.ActiveDocument.Bookmarks("Account").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![Acct #]))
.ActiveDocument.Bookmarks("Company").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![TO]))
.ActiveDocument.Bookmarks("CUSTOMER").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![ATT]))
.ActiveDocument.Bookmarks("TODAY").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![DATE]))
.ActiveDocument.Bookmarks("REQ").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![REQUISITION #]))
.ActiveDocument.Bookmarks("REQUISITIONED").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![REQUISITIONED BY]))
.ActiveDocument.Bookmarks("SHIP").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![WHEN SHIP]))
.ActiveDocument.Bookmarks("VIA").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![Ship Via]))
.ActiveDocument.Bookmarks("FOB").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![F O B POINT]))
.ActiveDocument.Bookmarks("TERM").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![Terms]))
.ActiveDocument.Bookmarks("QTYORD").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![PO ALL WOOL DESC subform].Form![QTY ORD]))
.ActiveDocument.Bookmarks("UM").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![PO ALL WOOL DESC subform].Form![U/M]))
.ActiveDocument.Bookmarks("ITEM").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![PO ALL WOOL DESC subform].Form![ITEM]))
.ActiveDocument.Bookmarks("STYLE").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![PO ALL WOOL DESC subform].Form![STYLE]))
.ActiveDocument.Bookmarks("STOCKNUMBER").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![PO ALL WOOL DESC subform].Form!
I would like to have all my data sent to a microsoft word file from a continuous subform.
At this moment I can only send one record.
This is my code below:
Private Sub Command143_Click()
On Error GoTo markerr:
Dim objWord As Word.Application
Set objWord = CreateObject("Word.application")
With objWord
.Visible = True
.Documents.Open ("Y:\Mark\Vendor's Database\PO\GAMEPO.doc")
.ActiveDocument.Bookmarks("PO").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![PO]))
.ActiveDocument.Bookmarks("Account").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![Acct #]))
.ActiveDocument.Bookmarks("Company").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![TO]))
.ActiveDocument.Bookmarks("CUSTOMER").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![ATT]))
.ActiveDocument.Bookmarks("TODAY").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![DATE]))
.ActiveDocument.Bookmarks("REQ").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![REQUISITION #]))
.ActiveDocument.Bookmarks("REQUISITIONED").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![REQUISITIONED BY]))
.ActiveDocument.Bookmarks("SHIP").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![WHEN SHIP]))
.ActiveDocument.Bookmarks("VIA").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![Ship Via]))
.ActiveDocument.Bookmarks("FOB").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![F O B POINT]))
.ActiveDocument.Bookmarks("TERM").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![Terms]))
.ActiveDocument.Bookmarks("QTYORD").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![PO ALL WOOL DESC subform].Form![QTY ORD]))
.ActiveDocument.Bookmarks("UM").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![PO ALL WOOL DESC subform].Form![U/M]))
.ActiveDocument.Bookmarks("ITEM").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![PO ALL WOOL DESC subform].Form![ITEM]))
.ActiveDocument.Bookmarks("STYLE").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![PO ALL WOOL DESC subform].Form![STYLE]))
.ActiveDocument.Bookmarks("STOCKNUMBER").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![PO ALL WOOL DESC subform].Form!
Code:
))
.ActiveDocument.Bookmarks("UP").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![PO ALL WOOL DESC subform].Form![UP]))
.ActiveDocument.Bookmarks("TOTAL").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![PO ALL WOOL DESC subform].Form![TOTAL]))
.ActiveDocument.Bookmarks("NOTES").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![PO ALL WOOL DESC subform].Form![NOTE]))
.ActiveDocument.Bookmarks("grandtotal").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![PO ALL WOOL DESC subform].Form![GRABTOTAL]))[/b]
.ActiveDocument.Bookmarks("Authorized").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![REQUISITIONED BY]))
.ActiveDocument.Bookmarks("Copy").Select
.Selection.Text = (CStr(Forms![PO ALL WOOL]![COPY]))
End With
Dim m As String
m = Me.WPO & " " & Me.TO & ".doc"
objWord.ActiveDocument.SaveAs FileName:="Y:\Mark\Vendor's Database\PO\" & m
markerr:
If Err.Number = 94 Then
objWord.Selection.Text = ""
Resume Next
End If
Exit Sub
End Sub
Would I need to create more bookmarks?
I use this file to create a purchase order.
Thanks in advance for you attention!