Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2003 Compatibility 1

Status
Not open for further replies.

AlexCuse

Programmer
Apr 13, 2006
5,416
US
So I was on vacation yesterday, and I come back only to find that Access 2003 has been installed on my computer... :-<

At first I thought that there would be only the stupid warnings at startup to worry about (which there are) but it appears that some of my code is incompatible with 2003. This code is to run a mail merge preparing form letters for the day's leads in the database. The red is where Access is choking. Any advice on this one? Any help would vastly improve my day, which is off to a miserable start.

Code:
Public Function MailMergeMemo()

Dim WordFileTemplateName    As String
Dim WordFileOutputName    As String

If Weekday(Date) <> 2 Then    'Is today's date Monday ?
   
   WordFileTemplateName = _
                "pathname\file.doc"
 
Else                          'Include Seeds on Monday
   WordFileTemplateName = _
                "pathname\file.doc"
End If
    
   WordFileOutputName = Format(Date - 1, "mmddyy") & "file.doc"
    
    
    Set appword = CreateObject("word.application")
    appword.Visible = True
    appword.Documents.Open WordFileTemplateName
     
     With ActiveDocument.MailMerge
       [COLOR=red].Destination = wdSendToNewDocument[/color]
        .MailAsAttachment = False
        .MailAddressFieldName = ""
        .MailSubject = ""
        .SuppressBlankLines = True
        With .DataSource
            .FirstRecord = wdDefaultFirstRecord
            .LastRecord = wdDefaultLastRecord
        End With
        .Execute Pause:=True
    End With
    
    ChangeFileOpenDirectory _
        "pathname"
    ActiveDocument.SaveAs filename:=WordFileOutputName, FileFormat:= _
        wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:= _
        True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _
        False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
        SaveAsAOCELetter:=False
        appword.Quit (False) 'without saving
'        appword.Documents("filename.doc").Close
'        DoCmd.Quit 'quit access driver file
End Function

Thanks a lot,

Alex



It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
 
The red is where Access is choking
Any error message ?
no references issues ?
Does the DB compiles properly ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Yeah that might have helped...

It opens the mail merge doc then gives run-time error '5852' Requested Object is not available. (Trying to go back into the access db to grab records)

It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
 
What about replacing ALL ActiveDocument with [!]appword.[/!]ActiveDocument ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Good thought PH, and that should have been done anyway but it is not the solution. When I open the doc it tells me that 'Opening This document will run the following SQL command', could it be that this box needs to be handled using VBA somehow? I did not write this code and have never had to open this document until today, so I am not sure if it was always there.

Thanks a lot,

Alex

It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
 
Wow, I did not think it would come to that. I guess I can give up looking for ways to turn off those security warnings in the new version of Access. I think the best solution for this case would be to send the mailer the merge template and then send him the source query output each day so he can do the merge on his own.

Thanks for your help PH, glad (in a way) to know that I wasn't missing anything. Hopefully this teaches the decision makers to not just run into a software change like that without testing.

It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top