We help IT Professionals succeed at work.
Get Started

Trouble with AddFromGuid

RBianca asked
Last Modified: 2012-05-10
Good morning Geniuses!

I'm having a problem with a PDFCreator reference in Access 2003.  

When this application was originally rolled out to the users, PDFCreator was one of the references that was checked (included).  But when the users tried to run the app for the first time, they would wind up with a broken reference.  The only way to correct it was to uncheck the reference on the user's pc, then recheck it and all would be fine.

We tried to correct this by trying to trap for (and correct) broken references.  This was not successful.  We still had to make house calls to uncheck and recheck the reference.

This time around, I unchecked the reference before rolling the app out.  The code I added is supposed to check for the reference and if not found (not checked), it was supposed to add it from the GUID (see code below).  But it also doesn't work.  The reference remains unchecked even though it is not found.  

Since I grabbed the GUID from my own PC during testing, do you think it is not working because the GUID on my user's pc is different?  Or its location is different?  Or version?

I guess I really don't understand how the GUID works...

Thanks in advance for the help!

Dim ref As Reference
Dim PDFfound As Boolean

PDFfound = False

For Each ref In References
   If ref.name = "PDFCreator" Then
      PDFfound = True
   End If
Next ref

If Not PDFfound Then
   ReferenceFromGUID ("PDFCreator")
End If


Function ReferenceFromGUID(strFilename As String) As Boolean 

If strFilename = "PDFCreator" Then
   References.AddFromGuid "{1CE9DC08-9FBC-45C6-8A7C-4FE1E208A613}", 0, 0
   ReferenceFromGUID = True
End If

   Exit Function

   MsgBox Err & ": " & Err.description
   ReferenceFromGUID = False
   Resume Exit_ReferenceFromGUID
End Function

Open in new window

Watch Question
Top Expert 2016
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE