Gustav Brock
gustav at cactus.dk
Wed Jul 23 14:30:44 CDT 2003
Hi John In most cases this could be done. However ... DAO or ADO could be lost as well (not very likely I know, but it could) and then your code would fail. The other primitive code using DoCmd _will_ run if Access runs and I feel that has the highest priority. /gustav > 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