[AccessD] favor running code in 2K and XP

Charlotte Foust cfoust at infostatsystems.com
Fri Jun 25 14:01:46 CDT 2004


OK, I set references to the Access object library.  That allowed me to
use Access.whatever syntax.  This will break of course between versions,
since Access 10 executable is not in the same folder/reg key as Access
11.

    Dim objRef As Access.Reference

I also had to use Access.Application, since Application.Whatever alone
didn't work with a broken reference

    For intCount = Access.Application.References.Count To 1 Step -1
        Set objRef = Access.Application.References(intCount)
        strRefPath = objRef.FullPath
        
I also had to specify the VBA library when using built in function,
since they break if the references are broken also.

        If VBA.InStr(strRefPath, "RIMCDORedemption") > 0 Then

Finally, remove and reference:

        ' remove the broken and add it back
         Access.Application.References.Remove objRef
         Access.Application.References.AddFromFile strAccessPath &
strFile
                                     
         ' if any broken references were handled, recompile the  project
         ' See MSKB 194374 for info on SysCmd hidden arguments
         ' Note that if we do NOT run the compile, the repaired
reference
         ' does not seem to "stick" and this will run each time the app
opens
         Access.Application.SysCmd 504, 16483

Does this help?

Charlotte Foust

-----Original Message-----
From: Charlotte Foust 
Sent: Friday, June 25, 2004 10:49 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] favor running code in 2K and XP


Susan,

I worked through a problem with references in 2002 in this list some
months back.  Take a look in the archives.  I did use late binding, but
I think I did something else too.  I'll try to find the code I wrote
(which we never used, BTW).

Charlotte Foust

-----Original Message-----
From: Susan Harkins [mailto:ssharkins at bellsouth.net] 
Sent: Friday, June 25, 2004 8:16 AM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] favor running code in 2K and XP


Yes -- but that's the point of the code. If the reference is "missing"
-- the code removes it. Unfortunately, the Remove method doesn't always
work. The code works fine in 2003, just not in 2000 and 2002. It's
apparently a known bug. If you're going to include the Remove method in
2000 or 2002 code, all you can do is just put in the appropriate
error-handler. Or, use late-binding to avoid it altogether. 

You'd think they'd have fixed the bug a lot sooner, but I don't run MS.
;) On the other hand, I don't have any updates for 2000 installed, so
it's possible that they did fix it somewhere along the line, but since
it still appears in XP, I'm guessing not. 

Susan H. 

Susan,

Is the reference listed as "MISSING" in Access 2000?  Missing references
can cause all kinds of havoc in VRA, even with methods not related to
the missing reference.

If it is missing, either install Excel and make sure the reference is
set, or delete the reference.  Then see if you are still having trouble.

HTH,

Steve

-----Susan Harkins' Original Message-----

An editor's having trouble with the Remove method in 2K and XP. I was
able to re-create it by running an Access 2003 db with a reference to
Excel 2003 on a system with Access 2000 and no Excel. The error says the
object doesn't suppor the method -- and points to the Remove method, but
it's there in Intellisense. 
 
It's only 2000 and 2k -- any ideas? 
 
Susan H. 
 
 
Sub RemoveBrokenReferences()
  'Find and remove broken references
  Dim ref As Reference
  For Each ref In Application.References
      If ref.IsBroken = True Then
        Application.References.Remove ref
      End If
    Next
End Sub

--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list