Rocky Smolin at Beach Access Software
rockysmolin at bchacc.com
Tue Mar 18 09:40:05 CDT 2008
Here it blew with the With/End With and when I removed that and added the mudTH(n) explicitly (mudTH(n).x) it worked. Go figure. I'm using A2K3. Don't know if that makes a difference. Rocky -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert Sent: Tuesday, March 18, 2008 6:24 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Array is locked I don't think so!! :-) This code runs without complaint... Type fooBar x As Long y As String End Type Sub ArryTest() Dim lngDeletes As Long Dim mudTH() As fooBar ReDim mudTH(1 To 41) With mudTH(1) .x = 1 .y = "one" End With Debug.Print mudTH(1).x, mudTH(1).y lngDeletes = 40 If lngDeletes <> 0 Then Dim lngTemp As Long lngTemp = UBound(mudTH) - lngDeletes ReDim Preserve mudTH(1 To lngTemp) End If End Sub I still favor the corrupt module theory. Lambert -----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 6:07 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Array is locked 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 -- 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 No virus found in this incoming message. Checked by AVG. Version: 7.5.519 / Virus Database: 269.21.7/1332 - Release Date: 3/17/2008 10:48 AM