jcolby at colbyconsulting.com
jcolby at colbyconsulting.com
Wed Jul 23 12:53:01 CDT 2003
Hey, that is seriously cool stuff (if it works of course). I modified the code as follows: Dim strSQL As String On Error Resume Next strSQL = "SELECT Left$('asdf',1) AS Test;" ' Run the query qryTestRefs you created and trap for an error. ' Set rs = db.OpenRecordset("qryTestRefs", dbOpenDynaset) Set rs = db.OpenRecordset(strSQL, dbOpenDynaset) The idea is to simply build an SQL statement "on the fly" that uses the left$ function. then open the recordset using the SQL string rather than a specific query referencing a specific table. This allows me to avoid having to have that query built and in the target database, i.e. avoids "knowing about the target". Which allows me to throw this out in my framework and just call the function as part of my framework startup. I just finished doing that. It would be nice to get some testing done to see what happens when a reference breaks. For example what happens if you reference a specific office file and the office location is different on the target? This tecnique would still fail (obviously) but it would be handy in that case to pop up a message explicitly telling the user (who could tell the developer) what fully pathed file could not be found. This thing could be seriously handy! John W. Colby www.colbyconsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Marcus, Scott (GEAE, Contractor) Sent: Wednesday, July 23, 2003 1:00 PM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Broken References in Runtime AXP Charlotte, I know that I'm jumping in the middle here but... Your solution is in the Microsoft knowledge base. The article is 194374. I have used this method for years. It works very well Here is a link to the article: http://support.microsoft.com/default.aspx?scid=kb;en-us;194374 Scott -----Original Message----- From: Charlotte Foust [mailto:cfoust at infostatsystems.com] Sent: Wednesday, July 23, 2003 12:01 PM To: Access Developers discussion and problem solving Subject: RE: [AccessD] Broken References in Runtime AXP OK, here's the situation as it stands. Using a query, as Gustav suggested, seems to give me an accurate way to test for a broken reference. I call that test from my FixReference routine and if it's true, I repair the library reference by removing it add adding it back. RefLibPaths gives me the correct path for adding it back, so that part is easy. This works in runtime or full installation and only performs the fix if the reference is actually broken. The compile issue is a bit trickier and I found a kludge, but I'm open to suggestions if anyone has them. The undocumented SysCmd(504, 16483) doesn't error but it doesn't seem to compile either. I ran into a post on the net that suggested it might not work with modules open (didn't say how you ran code otherwise, but I assume the reference was to the 97 VBE) so I started thinking "macro". If found that if I modify my autoexec macro, it will run the compile for me. So an autoexec that looks like this compiles the app after fixing the reference: Condition Action Command IIf(FixReference()=True,True,False) ... RunCommand CompileAndSaveAllModules OpenForm frmSplash Charlotte Foust _______________________________________________ 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