View Full Version : Solved: Databases in Arrays
jauner
11-18-2005, 03:11 PM
Is there a way to have database functions such as reading databases in an array and then have that array available while the entire database is open so when i close the form it is still in existence?
I am trying to minimize data reads
:think:
Cosmos75
11-21-2005, 06:54 PM
You can declare your Array as a Global Array. You will need to understand the lifetime of a variable. Try searching for 'Understanding Scope and Visibility' in VBA Help.
Dim myArray() As Long
Sub CreateArray()
ReDim myArray(1 To 10)
For i = LBound(myArray) To UBound(myArray)
myArray(i) = i
Next i
End Sub
Sub DebugPrintArray()
For i = LBound(myArray) To UBound(myArray)
Debug.Print "myArray(" & i & ") = " & myArray(i)
Next i
End Sub
Sub TestIt()
CreateArray
DebugPrintArray
End Sub
Another option would be to write the data to a table instead and delete data in the table when you exit the database, but you have to be careful of the database bloat.
How much data are you needing to store?
I hope I understood your question properly.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.