R
Robert
Howdy folks. I have been spinning my wheels on this little issue for a
couple days now, and have been searching the net with no luck finding a
solution.
Within the Access file, I open a user's record. Then I can click a button
that calls a sub routine that populates the word template via bookmarks.
Works great, except someone wanted to change it - now I need to pull data for
a field from a different column. The column I need the data from is a number
field. The form does the lookup into another table to obtain the value of
that number. The two tables have a relationship on this value. Problem is
that when I export that field to the Word doc, I only get the number value -
not the text value. I know it's something simple, but I have not found the
right place to make the change.
This is the line of code I want to change:
.Item("Type").Range.Text = [Forms]![Contacts]![ContactTypeID] & " "
But I somehow need to change this so that it looks in the [Contact Types]
table, pulls the Description where the ID=ID.
Summarized command:
Private Sub Command180_Click()
'Declare an instance of Microsoft Word.
Dim Wrd As New Word.Application
Set Wrd = CreateObject("Word.Application")
'Specify the path and name to the Word document.
Wrd.Documents.Add "template.dot"
Wrd.Visible = True
'Replace each bookmark with current data.
With Wrd.ActiveDocument.Bookmarks
'[Removed]
.Item("Type").Range.Text = [Forms]![Contacts]![ContactTypeID] & " "
'[Removed]
End With
End Sub
----Any help appreciated. Thanks in advance.
couple days now, and have been searching the net with no luck finding a
solution.
Within the Access file, I open a user's record. Then I can click a button
that calls a sub routine that populates the word template via bookmarks.
Works great, except someone wanted to change it - now I need to pull data for
a field from a different column. The column I need the data from is a number
field. The form does the lookup into another table to obtain the value of
that number. The two tables have a relationship on this value. Problem is
that when I export that field to the Word doc, I only get the number value -
not the text value. I know it's something simple, but I have not found the
right place to make the change.
This is the line of code I want to change:
.Item("Type").Range.Text = [Forms]![Contacts]![ContactTypeID] & " "
But I somehow need to change this so that it looks in the [Contact Types]
table, pulls the Description where the ID=ID.
Summarized command:
Private Sub Command180_Click()
'Declare an instance of Microsoft Word.
Dim Wrd As New Word.Application
Set Wrd = CreateObject("Word.Application")
'Specify the path and name to the Word document.
Wrd.Documents.Add "template.dot"
Wrd.Visible = True
'Replace each bookmark with current data.
With Wrd.ActiveDocument.Bookmarks
'[Removed]
.Item("Type").Range.Text = [Forms]![Contacts]![ContactTypeID] & " "
'[Removed]
End With
End Sub
----Any help appreciated. Thanks in advance.