title: How to fill a text box in Microsoft Word with data from a MS Access form?
body: <p>Hello I am having trouble with trying to auto fill a word document with data that is calculated from my MS Access form.
  I have been following along with this Youtube video: <a href="https://www.youtube.com/watch?v=k176qcg-YCo" rel="nofollow noreferrer">https://www.youtube.com/watch?v=k176qcg-YCo</a> and when I run the code it opens word but it gets stuck in a loop, I believe. The function is called when the button is clicked, the code is provided below. Any help is highly appreciated!</p>
  
  <pre><code>Function fillwordform()
  Dim appword As Word.Application
  Dim doc As Word.Document
  Dim Path As String
  
  On Error Resume Next
  Error.Clear
  
  Set appword = GetObject(, "word.application")
  If Err.Number &lt;&gt; 0 Then
  Set appword = New Word.Application
  appword.Visible = True
  End If
  Path = "C:\Users\Jay\Documents\Monthly Update.docx"
  Set doc = appword.Documents.Open(Path, , True)
  With doc
      .FormFields("ItmRec").Result = Me.NVCItmRcv
  
  appword.Visible = True
  appword.Activate
  End With
  
  Set doc = Nothing
  Set appword = Nothing
  
  End Function
  </code></pre>
  
  <p>The "ItmRec" is the name of the text box im trying to fill in Word and the "Me.NVCItmRcv" is the name of the box that I want to pull the number from and put in the text box. If you need anymore details or anything please let me know! Again highly appreciate any help!</p>