[AccessD] Array is locked

Jim Lawrence accessd at shaw.ca
Tue Mar 18 19:00:20 CDT 2008


Hi Rocky:

I am almost sure that you have tested this but is any value is the array set
to 'null'? 

Jim

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin at
Beach Access Software
Sent: Tuesday, March 18, 2008 10:19 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Array is locked

Max:

Lbound is 1.  

Rocky
 




 	
	

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo
Sent: Tuesday, March 18, 2008 9:19 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Array is locked

Rocky,
Shot in the dark but is this zero-based? And if so does this affect a
deletion/insert operation?
Max
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin at
Beach Access Software
Sent: Tuesday, March 18, 2008 4:10 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Array is locked

Lambert:

I tried the decompile per your suggestion yesterday but no change.  I guess
it'll be one of those enduring mysteries of Access. :)

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 8:15 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Array is locked

I'm on Access 2002 (XP), but that really should not matter. I'm still
leaning towards a corrupted module and suggest that you try the decompile
process to see if it fixes it - don't forget to back up first.

E.g.

"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "d:\My
Documents\access\mayapp.mdb" /decompile

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: Tuesday, March 18, 2008 10:40 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Array is locked


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
 

--
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
 

--
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
 

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list