Gustav Brock
Gustav at cactus.dk
Mon Mar 17 10:57:21 CDT 2008
Hi Rocky As Lambert, I ran a small test, and code similar to yours runs fine, so I guess something else is going on at your place between this ReDim and the previous ReDim. /gustav >>> rockysmolin at bchacc.com 17-03-2008 16:31 >>> 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