[AccessD] Array is locked

Rocky Smolin at Beach Access Software rockysmolin at bchacc.com
Mon Mar 17 11:10:00 CDT 2008


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
 




 	
	

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert
Sent: Monday, March 17, 2008 8:47 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Array is locked

Rocky,

Just tried this code...

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)
    lngDeletes = 40
    If lngDeletes <> 0 Then
        Dim lngTemp As Long
        lngTemp = UBound(mudTH) - lngDeletes
        ReDim Preserve mudTH(1 To lngTemp)
    End If

End Sub

This executes with no complaints at all. 

So the questions in my mind are what does you user defined type look like
and what does the rest of your code do with the array? Are there any objects
stored in the array? Could you have some reference in memory to one of the
'deleted' elements, so when you try to Redim to a smaller sized array the
object reference is causing the lock?

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


Gustav:

I modified the code to:

        If lngDeletes <> 0 Then
            Dim lngTemp As Long
            lngTemp = UBound(mudTH) - lngDeletes
            'ReDim Preserve mudTH(1 To UBound(mudTH) - lngDeletes)
            ReDim Preserve mudTH(1 To lngTemp)
        End If

But got the locked error anyway.  Could it have soething to do with the fact
that the array is DIMmed as THRecord where THRecord is a Type?

TIA

Rocky
 




 	
	

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Monday, March 17, 2008 8:20 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Array is locked

Hi Rocky

If

  ReDim Preserve mudTH(1 To 1)

works, I would first calculate UBound(mudTH) - lngDeletes in a variable and
then use that.

/gustav


>>> rockysmolin at bchacc.com 17-03-2008 16:09 >>>

 
Dear List:
 
I am getting an error 10 - This array is fixed or temporarily locked - when
executing:
 
ReDim Preserve mudTH(1 To UBound(mudTH) - lngDeletes)
 
where Ubound(mudTH) = 41 and lngDeletes = 40.
 
The conditions which would cause this as listed in the Help do not seem to
apply in this case.  
 
Access, being what it is, the error may not be exactly descriptive.  Does
anyone know of other reasons why you might get this error on a ReDim
Preserve?
 
MTIA
 
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
--
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
 




More information about the AccessD mailing list