Gustav Brock
gustav at cactus.dk
Tue Jul 22 14:02:36 CDT 2003
Hi Charlotte That is of course correct. Users have no patience. However, it may not be that processor dependant. I've tested it on a 266 MHz machine and the test lasts only for a couple of seconds for seven assorted references. But another trick is to run a potentially error raising query and trap an error. That takes only a split second but will cause a briefly flash of the open query. This is an example of how to do that; the in-line comments should be all you need: <code> Public Function CheckReferences( _ ByVal booErrorDisplay As Boolean) As Boolean ' Try to check - without using DAO or ADO - if a reference is broken by ' running a query with an expression using a "standard" built in function. ' Example of query string using Right(): ' SELECT TOP 1 Id, Date() AS Check FROM MSysObjects; ' ' As the query will flash briefly when opened, resize it to minimum size ' and position it in a corner of the app window before saving it. ' ' Returns True if references were OK or could be validated successfully. ' ' 2001-08-01. Cactus Data ApS. CPH. ' Query with expression that may fail. Const cstrRefQry As String = "USysQryReferencesCheck" ' Errors to trap. ' Error 2001: Query is "too complex". Const clngRefError1 As Long = 2001 ' Error 3075: Function isn't available in expressions in query expression. Const clngRefError2 As Long = 3075 Dim lngError As Long Dim booChecked As Boolean On Error Resume Next ' Run the query and record a possible error. DoCmd.OpenQuery cstrRefQry, acViewNormal ' If error clngError is raised, a reference is missing. lngError = Err.Number ' Close checking query. DoCmd.Close acQuery, cstrRefQry Select Case lngError Case 0 ' No errors. booChecked = True Case clngRefError1, clngRefError2 ' Run the function to fix the references. booChecked = VerifyReferences(booErrorDisplay) Case Else ' Another error occurred. ' Return False. End Select CheckReferences = booChecked End Function </code> /gustav > I tested it and it works but we would have to figure out how to make it > run just once to fix the reference and then disable it going forward. > The delay is significant, and I'm running a fast machine, which many of > our customers aren't. > Charlotte Foust > -----Original Message----- > From: Gustav Brock [mailto:gustav at cactus.dk] > Sent: Monday, July 21, 2003 10:50 PM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Broken References in Runtime AXP > Hi Charlotte > Did you try to apply my Function VerifyReferences() - or similar - which > I posted earlier? > The problem is that Access believes the references are OK but at least > one turns out not to be. > This bug is a bummer and it is unbelievable that MS has allowed it to > survive since A97 - or probably since A95. > It would be nice if someone working with Access 2003 beta could report > back to MS if the bug still exists. I am, however, fully aware that it > will take quite some time to test this ... > /gustav >> The reference resolves using the RefLibPaths key. Unfortunately, I'm >> still getting a #Name? Error on a control bound to the expression >> Format(Date(),"dd-mmm-yyyy"). Any other suggestions.