Hi,
Is it possible to create a new collection, fill it with values from some table and that that collection can be accessible from any module or form after program is started.
I would like to use collection as public variable for storage of some variables
which will be used very often inside whole program.
Reason for this is that I can't declare public variables in front because users can enter their own inside one table, and to use dlookup or query to pull them out each time it's needed is a bit slow.
I'm currently using following code to fill up collection, but I can access it only inside that procedure (testing it with debug.print).
If not using collection, do you have any other suggestions.
Any help is very appreciated
Is it possible to create a new collection, fill it with values from some table and that that collection can be accessible from any module or form after program is started.
I would like to use collection as public variable for storage of some variables
which will be used very often inside whole program.
Reason for this is that I can't declare public variables in front because users can enter their own inside one table, and to use dlookup or query to pull them out each time it's needed is a bit slow.
I'm currently using following code to fill up collection, but I can access it only inside that procedure (testing it with debug.print).
Code:
Public Function ClassFill()
Dim PrintersColl As New Collection ' Create a Collection object.
Dim rst As Recordset, dbs As Database
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("tbl_Printer_con_codes")
Do Until rst.EOF
PrintersColl.Add Item:=Chr$(rst!printer_Code_1) & rst!Printer_Code_2 & Chr$(Nz(rst!Printer_Code_3, 0)), key:=rst!Printer_Job
rst.MoveNext
Loop
Debug.Print PrintersColl.Item("INIT")
End Function
Any help is very appreciated