Command Button

  • Thread starter Thread starter Froto
  • Start date Start date
F

Froto

Here's my problem.

I am following Cheryl Fischer's 1/23/2004 post regarding
sending data from access form to word template I created.
I have the following code behind the onclick of my
command button.

Dim objWord As Object
Set objWord = New Word.Application
objWord.Documents.Add "\\Bulldog\Admin\Copy Of
Analytical Forms Database\FormID.dot"
objWord.Visible = True
If objWord.ActiveDocument.Bookmarks.Exists("Date") =
True Then
objWord.ActiveDocument.Bookmarks("date").Range.Text =
Me!Date

End If

When I click on the command button the word document
opens no data is entered on word form but the following
error shows up for the line before End If

Runtime-error 13 Type Mismatch

Any Help Thank you
 
Hi Froto

It seems that Word is having trouble converting the contents of Me!Date into
text. I suggest you try:

objWord.ActiveDocument.Bookmarks("date").Range.Text = _
Me!Date & ""

By adding an empty string to the value, you will force VBA to make the
correct conversion for you.
 
Back
Top