Rocky Smolin at Beach Access Software
rockysmolin at bchacc.com
Mon Mar 17 17:07:25 CDT 2008
FYI: I figured it out - brute force, binary search - ReDimming various places in the module until I found where it failed. Turned out that if you use With/End with on the array, it's locked - and apparently stays locked for the duration of the module. Don't know if there's a way to unlock it. End With doesn't do it. Rocky -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin at Beach Access Software Sent: Monday, March 17, 2008 9:49 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Array is locked Arthur: I tried this: For lngI = 1 To UBound(mudTH) If mudTH(lngI).fOrdering = True Then If lngI <> UBound(mudTH) Then ' if not the last record in the TH array For lngL = lngI To UBound(mudTH) - 1 mudTH(lngL) = mudTH(lngL + 1) Next lngL End If lngDeletes = lngDeletes + 1 ReDim Preserve mudTH(UBound(mudTH) - 1) End If Next lngI 'If lngDeletes <> 0 Then ReDim Preserve mudTH(UBound(mudTH) - lngDeletes) Where before the first ReDim was commented out. I uncommented it and got the lock message first time .fOrdering was True. The rest of the code moves all the downstream elements of the array up one element to delete the current element. It's a legacy app and really one huge bowl of spaghetti. I'm thinking about going around the problems by substituting a variable lngUboundmudTH for everywhere the code uses UBound(mudTH) abd just reduce that variable in this case by lngDeletes. But finding all occurrences of UBound(mudTH) could be a problem since it might be in Control Sources, Record Sources, stored queries, almost anyplace. Like I say - legacy code. Rocky -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: Monday, March 17, 2008 9:31 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Array is locked Just a wag, Rocky, but what if you ReDimmed the array element by element? It might be that something somewhere in the middle is causing the problem. You could easily find out whether the whole array is locked by just shrinking it one element. If that works then try the loop and decrement the size until she goes boom. Just a wag, as I said. Arthur On 3/17/08, Rocky Smolin at Beach Access Software <rockysmolin at bchacc.com> wrote: > > Lambert: > > Here's the Type: > > Private Type THRecord > TaskID As Long 'T > StartDate As Date 'S > DueDate As Date 'D > QuasiDueDate As Date 'Q > TargetDate As Date 'R > RequiredHours As Double 'H > EarliestCompleteDate As Date 'C > ASAP As Double 'A > fOrdering As Boolean 'F > ErrorHours As Double 'E > TempReg As Double 'Z > DueDateFlag As Boolean 'FD > PastDueFlag As Boolean 'FP > ASAPFlag As Boolean 'FA > TargetDateFlag As Boolean 'FT > End Type > Dim mudTH() As THRecord 'TH > > There are lots of references to elements in the aray but at the point > where the redim occurs, there are no references. Does any reference > lock the array and then the lock persists? Is there a way to > determine what element in an array is causing the lock or a way to > release the array? > > > TIA > > Rocky > > > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com No virus found in this incoming message. Checked by AVG. Version: 7.5.519 / Virus Database: 269.21.7/1331 - Release Date: 3/16/2008 10:34 AM -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com No virus found in this incoming message. Checked by AVG. Version: 7.5.519 / Virus Database: 269.21.7/1331 - Release Date: 3/16/2008 10:34 AM