K
KCFAAENGR
Am trying to link Access Data Base with Word Application want to pass data
from Access to Word. Have application working under Access 2000 now as we are
getting ready to upgrade to Access 2003 the line of code with DDEINITIATE
gives me a typemismatch error#13
Dim cNum As Long
Dim q As String * 1
Dim x As Integer
Dim strSQL As String
q$ = Chr$(34)
DoCmd.RunSQL "Update Distinctrow DDE SET DDE.ArptID = " + q$ +
Forms![WHEAT]![AirportID] + q$ + ", DDE.RecNum = " + Forms![WHEAT]![Names] +
", DDE.Template = " + q$ + Forms![WHEAT]![Template] + q$ + " Where
((DDE.ID=1));"
MsgBox "MSGBOX 1 Made it past DoCmd.RunSQL"
Dim appWord As Word.Application
MsgBox "MSGBOX 2 Made it past AppWord"
On Error Resume Next
Set appWord = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set appWord = CreateObject("Word.Application")
If Err.Number <> 0 Then
Set appWord = CreateObject("Word.application")
appWord.Visible = True
End If
End If
MsgBox "MSG BOX 3 made it past check to see if word running"
'appword.filenew.template (
On Error GoTo ErrorTrap
MsgBox "MSGBOX 4 Made it Past On Error GoTo ErrorTrap"
cNum = DDEInitiate("WINWORD", "SYSTEM")
MsgBox "cNum = " + cNum
'DDEExecute cNum, "[FileNew]"
'DDEExecute cNum, "[ToolsMacro .Name = " + q$ + "DocRestore" + q$ + ",
..Run]"
'DDEExecute cNum, "[DocClose 2]"
'starting up new word document based upon template selected by user...
DDEExecute cNum, "[FileNew .Template = " + q$ + "f:\wheatvb\" + Template
+ q$ + "]"
DDETerminate cNum
DDETerminateAll
MsgBox " MSGBOX 5A: Made it through DDE"
GoTo EndSub
DJ
from Access to Word. Have application working under Access 2000 now as we are
getting ready to upgrade to Access 2003 the line of code with DDEINITIATE
gives me a typemismatch error#13
Dim cNum As Long
Dim q As String * 1
Dim x As Integer
Dim strSQL As String
q$ = Chr$(34)
DoCmd.RunSQL "Update Distinctrow DDE SET DDE.ArptID = " + q$ +
Forms![WHEAT]![AirportID] + q$ + ", DDE.RecNum = " + Forms![WHEAT]![Names] +
", DDE.Template = " + q$ + Forms![WHEAT]![Template] + q$ + " Where
((DDE.ID=1));"
MsgBox "MSGBOX 1 Made it past DoCmd.RunSQL"
Dim appWord As Word.Application
MsgBox "MSGBOX 2 Made it past AppWord"
On Error Resume Next
Set appWord = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set appWord = CreateObject("Word.Application")
If Err.Number <> 0 Then
Set appWord = CreateObject("Word.application")
appWord.Visible = True
End If
End If
MsgBox "MSG BOX 3 made it past check to see if word running"
'appword.filenew.template (
On Error GoTo ErrorTrap
MsgBox "MSGBOX 4 Made it Past On Error GoTo ErrorTrap"
cNum = DDEInitiate("WINWORD", "SYSTEM")
MsgBox "cNum = " + cNum
'DDEExecute cNum, "[FileNew]"
'DDEExecute cNum, "[ToolsMacro .Name = " + q$ + "DocRestore" + q$ + ",
..Run]"
'DDEExecute cNum, "[DocClose 2]"
'starting up new word document based upon template selected by user...
DDEExecute cNum, "[FileNew .Template = " + q$ + "f:\wheatvb\" + Template
+ q$ + "]"
DDETerminate cNum
DDETerminateAll
MsgBox " MSGBOX 5A: Made it through DDE"
GoTo EndSub
DJ