From: Peter Stone on
Access 2003/XP Pro
I want to create and link MS Word Documents from Access.
I have put an unbound frame on an Access form that on double-clicking opens
a blank document in Word. The SourceDoc property is C:\Doc\Doc1.doc.

I would like to rename the document using text from the controls on my form.
E.g. if cboDest.Column(1) is North Beach and txtHeading is Calzone's
Restaurant, I would like to Save As: North Beach Calzone's Restaurant.

Thank you
From: mjmcevoy on
Have you tried:

Name "CurrentFileName.doc" As cboDest.Column(1) & me.txtHeading.value & ".doc"

"Peter Stone" wrote:

> Access 2003/XP Pro
> I want to create and link MS Word Documents from Access.
> I have put an unbound frame on an Access form that on double-clicking opens
> a blank document in Word. The SourceDoc property is C:\Doc\Doc1.doc.
>
> I would like to rename the document using text from the controls on my form.
> E.g. if cboDest.Column(1) is North Beach and txtHeading is Calzone's
> Restaurant, I would like to Save As: North Beach Calzone's Restaurant.
>
> Thank you
From: mjmcevoy on
Will most likely need to add the me. and .value to the combo baox name as well.

"mjmcevoy" wrote:

> Have you tried:
>
> Name "CurrentFileName.doc" As cboDest.Column(1) & me.txtHeading.value & ".doc"
>
> "Peter Stone" wrote:
>
> > Access 2003/XP Pro
> > I want to create and link MS Word Documents from Access.
> > I have put an unbound frame on an Access form that on double-clicking opens
> > a blank document in Word. The SourceDoc property is C:\Doc\Doc1.doc.
> >
> > I would like to rename the document using text from the controls on my form.
> > E.g. if cboDest.Column(1) is North Beach and txtHeading is Calzone's
> > Restaurant, I would like to Save As: North Beach Calzone's Restaurant.
> >
> > Thank you
From: Peter Stone on
Thanks for the suggestions.
I used the following:
Name "Doc1.doc" As Me.Parent!cboDest.Column(1).Value &
Me.Parent!txtHeading.Value & ".doc"

I get a message "Object required"



"mjmcevoy" wrote:

> Will most likely need to add the me. and .value to the combo baox name as well.
>
> "mjmcevoy" wrote:
>
> > Have you tried:
> >
> > Name "CurrentFileName.doc" As cboDest.Column(1) & me.txtHeading.value & ".doc"
> >
> > "Peter Stone" wrote:
> >
> > > Access 2003/XP Pro
> > > I want to create and link MS Word Documents from Access.
> > > I have put an unbound frame on an Access form that on double-clicking opens
> > > a blank document in Word. The SourceDoc property is C:\Doc\Doc1.doc.
> > >
> > > I would like to rename the document using text from the controls on my form.
> > > E.g. if cboDest.Column(1) is North Beach and txtHeading is Calzone's
> > > Restaurant, I would like to Save As: North Beach Calzone's Restaurant.
> > >
> > > Thank you
From: Peter Stone on
Here is my current attempt-which results in the message: Object required

'Private Sub cmdOpenWord_Click()
On Error GoTo Err_cmdOpenWord_Click

Dim LWordDoc As String
Dim oApp As Object

'Path to the word document
LWordDoc = "c:\Doc\DocBlank.doc"

If Dir(LWordDoc) = "" Then
MsgBox "Document not found."

Else
'Create an instance of MS Word
Set oApp = CreateObject(Class:="Word.Application")
oApp.Visible = True

'Open the Document
oApp.Documents.Open filename:=LWordDoc
Name "DocBlank.doc" As Me.cboDest.Column(1).Value &
Me.txtHeading.Value & ".doc"
End If

Exit_cmdOpenWord_Click:
Exit Sub

Err_cmdOpenWord_Click:
MsgBox Err.Description
Resume Exit_cmdOpenWord_Click

End Sub

Peter