Hi...hope someone can help. I'm a bit new to the programming scene and need some help with a recordset.
The current code that I am using is:
Private Sub Command126_Click()
'September - 2006 - Create Application Form.
Dim appWord As Word.Application
Dim NoPrompt
Dim rstContacts As Recordset
Set rstContacts = Me.Recordset
Set appWord = GetObject(, "Word.Application")
With appWord
.Documents.Add "C:\Documents and Settings\Administrator\My Documents\test.doc"
.ActiveDocument.ShowSpellingErrors = False
.Selection.Goto wdGoToBookmark, Name:="test"
End With
Do Until rstContacts.EOF
appWord.Selection.TypeText rstContacts!ContactName & " "
rstContacts.MoveNext
Loop
End Sub
I want a situation where recordset information can be 'fed' to a word document depending on what is written in control boxes on the form. So, for example if there are three options in a Combo Box, namely:
Option 1, Option 2 and Option 3
I want information from the 'ContactName' control box to be inserted in the 'test' document at specific 'bookmarks' for all forms where 'Option 1' is selected in the Combo Box.
Hope this makes sense....I think I'm getting close but still no joy
Thanks
Chris
The current code that I am using is:
Private Sub Command126_Click()
'September - 2006 - Create Application Form.
Dim appWord As Word.Application
Dim NoPrompt
Dim rstContacts As Recordset
Set rstContacts = Me.Recordset
Set appWord = GetObject(, "Word.Application")
With appWord
.Documents.Add "C:\Documents and Settings\Administrator\My Documents\test.doc"
.ActiveDocument.ShowSpellingErrors = False
.Selection.Goto wdGoToBookmark, Name:="test"
End With
Do Until rstContacts.EOF
appWord.Selection.TypeText rstContacts!ContactName & " "
rstContacts.MoveNext
Loop
End Sub
I want a situation where recordset information can be 'fed' to a word document depending on what is written in control boxes on the form. So, for example if there are three options in a Combo Box, namely:
Option 1, Option 2 and Option 3
I want information from the 'ContactName' control box to be inserted in the 'test' document at specific 'bookmarks' for all forms where 'Option 1' is selected in the Combo Box.
Hope this makes sense....I think I'm getting close but still no joy
Thanks
Chris