MS Access / Word Interface (1 Viewer)

RosemaryJB

Registered User.
Local time
Today, 17:12
Joined
Nov 6, 2006
Messages
24
I am not sure whether this is a problem with MS Access, Visual Basic or Windows. I have also posted this under MS Access so if you have already read it I apologise.

I have taken over supporting & developing an MS Access 2000 DB for a small charity & am not an Access expert or a programmer. The Application includes processing to create, amend & store retrieve standard letters based on a Word document called MyMerge.doc. The operating systems is Windows XP for the PCs with a MS Server 2003.

Each letter is allocated a number ‘CallID’ which is used to retrieve the letters later. The letter text is in MessageC.

The VB code to store the letters (Save As) is

Dim strTest As String, db As DAO.Database
Dim td As DAO.TableDef
Set db = CurrentDb
For Each td In db.TableDefs
If Len(td.Connect) > 0 Then MessageE = Mid(Left(td.Connect, InStrRev(td.Connect, "\") - 1), 11)
GoTo jumpout
Next
jumpout:
MessageC = "%fa" & MessageE & "\Db Letters\" & MessageC & " " & (CStr(Forms!Contacts![PostalCode])) & " " & Trim(DLookup("[TitleType]", "Title Types", "[TitleTypeID] = Forms!Contacts![TitleTypeID]") & " " & Forms!Contacts![FirstName] & " " & Forms!Contacts![LastName])
objWord.Application.Activate
SendKeys MessageC

The VB code to retrieve the letters is

Dim MessageE As String, db As DAO.Database
Dim td As DAO.TableDef
Set db = CurrentDb
For Each td In db.TableDefs
If Len(td.Connect) > 0 Then MessageE = Mid(Left(td.Connect, InStrRev(td.Connect, "\") - 1), 11)
GoTo jumpout
Next
jumpout:
Dim WordApp As Word.Application
Set WordApp = CreateObject("Word.Application")
WordApp.Visible = True
WordApp.Application.Activate
MessageE = "%fo" & MessageE & "\Db Letters\*" & CallID & "*.doc"
SendKeys MessageE
Set WordApp = Nothing
GoTo Exit_Command53_Click

The success rate varies from PC to PC and user to user. It will work with one letter and not the next. It is very difficult to identify a pattern. When the Save As does not offer the expected name & path, the Application (or operating system?) offers to save ‘MyMerge’ to the user’s My Documents folder.

In that case I tell the users to correct the path themselves and save the document under the CallID. Theoretically, retrieval should work since this uses the CallID and wild cards. Sometimes it does but often it will instead retrieve a document in the user’s My Documents folder. If it does go to the right folder, you sometimes have to replace the last wild card with ‘.doc’. I have tried replacing the last wild card in the VB code with ‘.doc’ but this does not work!

Finally, I alone get the message ‘Save failed due to out of memory or disk space’, neither of which is true. This makes it very difficult to continue investigating the problem. If I use a copy of the DB on my hard drive rather than the network I can save but not retrieve.
 

ivie_brasil

New member
Local time
Today, 09:12
Joined
Nov 23, 2006
Messages
3
Can anybody help with a simple issue?
Just trying to build a button so it takes me to my file on WORD??
I tried the wizard choosing runappl , they even give us an example on how to write the arguments.
like
Excel.exe c:\Documents\Label.xls but it doesn't seem to work...
 

Users who are viewing this thread

Top Bottom