Heenan, Lambert
Lambert.Heenan at AIG.com
Mon Mar 17 10:47:23 CDT 2008
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