Jim Lawrence
accessd at shaw.ca
Thu Feb 15 18:08:21 CST 2007
Hi Mark: You could scan through the entire source and then all the destination application references by using a module as follows: This function can be used to first scan for the required references as; CheckReferences ...or check for a specific for a specific references like; ... If CheckReferences("MSWORD10.OLB", False) = False Then ... I traditionally have the 'CheckReferences' auto run when the application is initialized. This should at least direct you to the specific missing reference(s). <Code> Public Function CheckReferences(Optional strSpecificReference As String, _ Optional bolAddFlag As Boolean) As Boolean Dim strMessage As String, strFullMessage Dim strTitle As String, strFullPath As String Dim refItem As Reference Dim bolRefExists As Boolean Dim bolBrokenRef As Boolean Dim i As Integer, intStartPosition As Integer On Error Resume Next If IsNull(bolAddFlag) Then bolAddFlag = False If IsNull(strSpecificReference) Then strSpecificReference = "" bolRefExists = False bolBrokenRef = False strFullPath = "" strMessage = "" strFullMessage = "" CheckReferences = False For Each refItem In References With refItem If .IsBroken = True Or InStr(1, .FullPath, "failed") > 0 Then If Len(strSpecificReference) > 0 Then If InStr(1, .FullPath, strSpecificReference) > 0 Then bolBrokenRef = True End If strMessage = "MISSING Reference: " & .Name & vbCrLf _ & "Location: Could not be found!" & vbCrLf Else If Len(strSpecificReference) > 0 Then If InStr(1, .FullPath, strSpecificReference) > 0 Then bolRefExists = True ElseIf bolAddFlag = True Then If .Name = "Access" Then intStartPosition = Len(.FullPath) For i = intStartPosition To 1 Step -1 If InStr(i, .FullPath, "\") > 0 Then strFullPath = Left(.FullPath, i) & strSpecificReference Exit For End If Next i End If End If End If strMessage = "Reference: " & refItem.Name & vbCrLf _ & "Location: " & .FullPath & vbCrLf End If End With If Len(strFullMessage) > 0 Then strFullMessage = strFullMessage & vbCrLf & strMessage Else strFullMessage = strMessage End If strMessage = "" Next refItem If Len(strFullMessage) > 0 Then If Len(strSpecificReference) > 0 Then If bolAddFlag = False Then CheckReferences = bolRefExists Else If bolRefExists = True Then CheckReferences = bolRefExists ElseIf bolBrokenRef = True Then CheckReferences = False Else Set refItem = References.AddFromFile(strFullPath) If Err.Number = 0 Then CheckReferences = True End If End If Else strFullMessage = strFullMessage & vbCrLf & "PLEASE record Information before Exiting." MsgBox strFullMessage, vbInformation End If End If End Function </Code> The previous code worked great for resolving remote client installation problems. HTH Jim -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A Matte Sent: Thursday, February 15, 2007 2:02 PM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Missing references Thanks John, I'm not referencing any other app or docs...I was referring to when you are in a module and goto TOOLS---REFERENCES...and there is something missing or incorrect. Is binding relevant at this point? If not...back to the original question:...how to handle the 'missing'??? Am I still confused>..lol...??? Thanks, Mark A. Matte >From: "JWColby" <jwcolby at colbyconsulting.com> >Reply-To: Access Developers discussion and problem >solving<accessd at databaseadvisors.com> >To: "'Access Developers discussion and problem >solving'"<accessd at databaseadvisors.com> >Subject: Re: [AccessD] Missing references >Date: Thu, 15 Feb 2007 16:56:40 -0500 > >BTW, you can use BOTH early binding and late binding by wrapping TWO sets >of >dim statements in #if statements: > >#Const EARLYBINDING = True > >#If EARLYBINDING = -1 Then >Private mxlApp As Excel.Application >Private mXLWB As Workbook >Private mXLWS As Worksheet >#Else >Private mxlApp As Object >Private mXLWB As Object >Private mXLWS As Object >#End If > >Now you can simply set EARLYBINDING to TRUE (-1) and the compiler will dim >the objects at compile time. > >Set EARLYBINDING to 0 and the compiler will dim the objects at run time. > >I do this so that I can use early binding during development, and then just >"throw a switch" to use late binding for runtime on the actual user's PC. >Of course you have to do that everywhere you want to bind such objects, >inside of functions that dim local objects, in the header for global >objects >etc. > >Once it is set up though it works very sweet. > >And Oh By The Way, there is a GLOBAL (to every module in the library) way >to >do this: > >In the VB Editor, click Tools / MyContainer Properties (the bottom menu >item) >In the General tab there is a "Conditional Compilation Arguments" where you >could define your EarlyBinding constant. > >Doing it there causes ALL MODULES that use that constant to switch from >early binding to late binding and back. > >Very handy!!! > >John W. Colby >Colby Consulting >www.ColbyConsulting.com > >-----Original Message----- >From: accessd-bounces at databaseadvisors.com >[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bryan Carbonnell >Sent: Thursday, February 15, 2007 4:38 PM >To: Access Developers discussion and problem solving >Subject: Re: [AccessD] Missing references > >On 2/15/07, Mark A Matte <markamatte at hotmail.com> wrote: > > > Since I'm not versed in Binding(Late or Early) ...I've looked at MS > > knowledge base...and most of what I found was problems and fixes. > > > > Any suggestions for 'crash course READING' in bindings? > >Here's a quick description that I lifted from an article I wrote >http://www.databaseadvisors.com/newsletters/newsletter072002/0207wordautoma t >ionlpt1.asp > > >Early Binding Versus Late Binding > >First you need to decide whether to use Early Binding or Late Binding. >Early Binding allows you to dimension variables by their specific data >type. >For example, the following declarations refer to the Word Application and >Document objects rather than declaring both as generic >objects: > >Dim objWord as Word.Application >Dim doc as Word.Document > >Early Binding also enables a few built-in Intelli-sense features: Auto >Complete, Auto List Members, and Auto Quick Info. In addition, using early >binding allows you to view Word's object model in the Object Browser. > >The downside to Early Binding is that you have to set a reference to a >specific version of Word. Sometimes Access is smart enough to change the >reference to the specific version of Word that is installed on the PC you >are deploying your application; often it isn't, and you could end up with >problems relating to the references. > >If you decide to use Late Binding, you will have to dimension all of your >variables as Objects as follows: > >Dim objWord as Object >Dim doc as Object > >Consequently, you cannot access any of your variables until you set them to >a specific object as shown below: > >Set objWord = CreateObject("Word.Application") Set doc = >objWord.Documents.Open("C:\Path\To\file.doc") > >In addition, the Intelli-sense features, Auto Complete, Auto List Members, >Auto Quick Info and disables viewing of Word's object model in the Object >Browser. However, Late Binding doesn't require that you set a reference to >any Word Object Library, which can be advantageous if you are deploying >run-time versions of your application to mixed OS/Office Version platforms. > >Instead of choosing one or the other, we suggest you compromise and use >both. During the development phase use Early Binding. Once you release the >application, remove all specific references and change each to Object-the >best of both worlds! > >Now that the binding issue is resolved, let's roll up our sleeves and dive >into writing some code. > > > >-- >Bryan Carbonnell - carbonnb at gmail.com >Life's journey is not to arrive at the grave safely in a well preserved >body, but rather to skid in sideways, totally worn out, shouting "What a >great ride!" >-- >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 _________________________________________________________________ >From predictions to trailers, check out the MSN Entertainment Guide to the Academy Awards. http://movies.msn.com/movies/oscars2007/?icid=ncoscartagline1