I would like help performing the following actions in VBA:
1. Create a dynamic array with two columns. Let’s say column A and column B
2. Add a row to the array from the current values of two variables: ProjectID and CStr(frm.Hwnd) to columns A and B respectively.
3. Search the array and retrieve the value of column B based lookup of column A
4. Delete a row in the array that has a specific value in column A
Thank you for any help on this,
Tim
Dim arr() as String
'/set multiple columns
Redim Preserve arr(ubound(arr)+1, 1)
arr(0, ubound(arr)) = Me.ProjectID
arr(1, ubound(arr)) = frm.Hwnd
To retrieve this:
Msgbox arr(0, <your array index>)
If you need to locate that value, use a Loop:
Dim i As Integer
For i = 0 to ubound(arr,2)
Msgbox arr(0, i) & " : " & arr(1, i)
Next i
This might help:
http://patorjk.com/programming/tutorials/vbarrays.htm