Hi all,
Apologies if this has been discussed before, but my numerous searches (google and otherwise) have come up with nothing.
What i need to do is open a word document (from Access 2003), from a filepath stored in a table, depending on the values returned in 2 combo boxes on a form. This is what i've got:
I recognise that the runSQL won't work because it's not an action query, but i'm stuck for an alternative.
Any advice would be greatly appreciated.
Thanks
Apologies if this has been discussed before, but my numerous searches (google and otherwise) have come up with nothing.
What i need to do is open a word document (from Access 2003), from a filepath stored in a table, depending on the values returned in 2 combo boxes on a form. This is what i've got:
Code:
Sub Run_Letters()
Dim strPath As String
Dim strSQL As String
strSQL = "SELECT tblLetter.filePath & tblLetter.fileName " & _
"FROM tblLetter" & _
"WHERE tblLetter.Fund = '" & [Forms]![frmMainMenu]![cboSelectFund] & "' AND " & _
"tblLetter.LetterName = '" & [Forms]![frmMainMenu]![cboSelectLetter] & "';"
DoCmd.RunSQL strSQL = strPath
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
oApp.Documents.Open strPath
End Sub
Any advice would be greatly appreciated.
Thanks
Comment