Issue with VBA Code Using Bookmarks in Word to populate from Access Form (1 Viewer)

BrianFawcett

Registered User.
Local time
Today, 11:43
Joined
May 3, 2010
Messages
63
I have a database where an administrator enters orders. For certain products, a warning pop-ups. Right now the user can open a Word doc of the warning, and I would like it to be populate with two fields from the Access Form they are using.

I am getting a Comile error:Invalid qualifier. Below is my code, can someone help me out.

Case "DS Inserters"
Msg = "INSERTER CONFIGURATION REQUIRED!!!" & vbCrLf & "" & vbCrLf & "This Order includes a DS Series Equipment and must be sent the contacts below for Configuration Approval" & vbCrLf & "" & vbCrLf & "DS 62 - DS 75 do not require approvals is ok to process" & vbCrLf & "" & vbCrLf & "DS 80 - DS 86 must be sent to MARK NAITO" & vbCrLf & "" & vbCrLf & "DS 100 - DS 1200 must be sent to RICK DEJAGGER" & vbCrLf & "" & vbCrLf & "Would you like to Print this message?" ' Define message.
Style = vbYesNo + vbExclamation + vbDefaultButton1 ' Define buttons.
Title = "DS SERIES INSERTER - CONFIGURATION REQUIRED!!!" ' Define title.
Response = MsgBox(Msg, Style, Title)

If Response = vbYes Then ' User chose Yes.
'start print
Dim MailDoc As String
Dim oApp1 As Object
'Path to the word document
MailDoc = "I:\DeptShare\C\Customer Service\Confidential\Custcare\2 - Reporting\New DDC Order Tracker\Order Tracker Documents\DS EQUIPMENT INSERTER CONFIGURATION REQUIRED.docx"
If Dir(MailDoc) = "" Then
MsgBox "Document not found."
Else
'Create an instance of MS Outlook
Set oApp1 = CreateObject(Class:="Word.Application")
oApp1.Visible = True
'Open the Document
oApp1.Documents.Open filename:=MailDoc

With MailDoc.Bookmarks
.Item("InHouseRef").Range.Text = Nz(Me.InHouseRef)
.Item("Name").Range.Text = Nz(Me.Name)

End With

End If
'stop print
Exit Sub ' Perform some action.

Else ' User chose No.
DoCmd.Close acForm, "New Entry Form"
End If
 

darbid

Registered User.
Local time
Today, 20:43
Joined
Jun 26, 2008
Messages
1,428
On which line does it error?

Here ?

With MailDoc.Bookmarks
.Item("InHouseRef").Range.Text = Nz(Me.InHouseRef)
.Item("Name").Range.Text = Nz(Me.Name)
 

Users who are viewing this thread

Top Bottom