Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 23rd, 2006, 12:06 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default getobject() failure- recent

Has anyone had a problem using GetObject?

I have an A2K app that has run FINE for the past 11 months and just today it is giving me "unable to find .dll" error. The error occurs when I run a click event with the attached code.... (see below). I checked my References and they appeared fine, tried compact and repair. Because it came on suddenly am wondering if perhaps there may have been some "updates/patches" distributed lately that may have caused this??.....

And anyone know of another way to get ahold of Word from Access. We are using this to launch a series of mailmerge letters that save us a tremendous amount of effort.

Thanks in advance-
Loralee

 
Old November 23rd, 2006, 12:04 PM
Authorized User
 
Join Date: Nov 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

1)is the dll really there?
2)uncheck the reference reboot then check it again and save it then run it again and test it
3)recreate the document from scratch and see if that fixes the problem
4)recreate the dll from scratch and see if that fixes the problem
5)the alternative to using mail merge is create a template and insert bookmarks, you could create a form in access with a button that triggers a macro that loops through a recordset until the end of the recordset that creates instances of the template, prints and saves one at a time and inserts data into the bookmarks based on queries, you could also use the open event in word to trigger the code, maybe you should try that instead of mail merge
6)Mail merge has limitations, what if you need to make calculations?
7)I can provide a demo if you wish, when I have time...
8)I didnt find any attached code
9)Did i mention Im addiced to vba? (I dont know why)
 
Old November 24th, 2006, 02:29 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default

Thanks- Will give #2 a try. I did confirm reference was checked, and then unchecked and checked it again, but did not re-boot between the two. Will try Monday. (I'm not sure WHAT dll it wants. As far as I can tell the rest of my VBA code in the app is running (at least I didn't get other strange results). My concern is that we received some "patch" that is interfering.....)
I am NOT familiar with the Word Object model and have not ventured into that territory other than this little button. We are using the sub to launch pre-set up Word DOTs and sending client's addresses and a few other basic info into a series of DOTs. None of the DOTs require calculations. (And I don't want to spark any new ideas- the users come up with enough on their own :) !!!

Thanks-
I thought I had inserted my code- oops. Here it is:

=========
Private Sub cmdMergeLetter_Click()
' open a Word DOT and start a mail merge; DOT is already set up as mailmerge
Dim strFilePath As String
Dim objWord As Word.Document
Dim strPatientID As String ' use to link to patient
Dim strSELECT As String
Dim strFROM As String
Dim strWHERE As String
Dim strSQLMerge As String

strPatientID = Forms!frmpatientdata.txtPatientID
strSELECT = "SELECT tblPatient.[PatientID], tblPatient.[PtFirstName], tblPatient.[PtLastName], tblPatient.[PtBD], tblCity.[City], tblPatient.[PtAddress], tblPatient.[PtZip], tblReferral.[ReferBy]"
strFROM = " FROM (tblCity INNER JOIN tblPatient ON tblCity.[CityID] = tblPatient.[PtCityFK]) INNER JOIN tblReferral ON tblPatient.[PatientID] = tblReferral.[PtFK]"
strWHERE = " WHERE ((([PatientID])= " & strPatientID & "))"
strSQLMerge = strSELECT & strFROM & strWHERE

CurrentDb.QueryDefs("qrymailmerge").SQL = strSQLMerge

Me.cmdlg.DialogTitle = "Choose File Name and Location"
Me.cmdlg.ShowOpen
strFilePath = Me.cmdlg.FileName

‘fails below on getobject() but strFilePath is filled appropriately
Set objWord = GetObject(strFilePath, "Word.document")’ fails on getobject()
' make word visible
objWord.Application.Visible = True

' execute the mail merge
objWord.MailMerge.Execute
objWord.Close


End Sub







Similar Threads
Thread Thread Starter Forum Replies Last Post
GetObject jdhock8865 Visual Basic 2005 Basics 2 November 3rd, 2008 09:29 PM
getObject() and shell() question using automation juneBugz Access VBA 0 August 29th, 2005 08:46 PM
GetObject Trap bostek VBScript 2 November 24th, 2004 02:39 AM
why GetObject with IIS is not working alyeng2000 ASP.NET 1.x and 2.0 Application Design 0 September 15th, 2004 09:00 AM
UCOMIRunningObjectTable.GetObject wstueve C# 0 December 18th, 2003 11:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.