XLEAccessGuru
XLEGuru
- Local time
- Today, 16:01
- Joined
- Nov 17, 2006
- Messages
- 65
Hi everyone,
I'd like to use an array to store a list of names. Then I would like to search the array to see if my name is the last value in the array. In essence, I need to determine if the person currently filling out this form is the last person in a list of names stored in an array. Make sense?
I already have a loop that cycles through controls on the form as shown at the bottom of this post. The array will contain 12 elements maximum, but may not always contain 12.
For example - if the array contains:
{John Doe, Jane Doe, My Name, Josh Doe, Ellen Doe}
After the array is filled, in this case, I need a boolean variable - let's call it - bnLast - to return "FALSE" because "MyName" is NOT the last name in the array.
Can anyone offer a link or some code for this to help me out? I'm terrible with arrays. I am notoriously awful at array usage, so any help with this would be great. My looping code is show below. Just need help adding code in it to fille the array and code after it to tell me if MyName is the last value in the array.
Thanks in advance to anyone who can save me here!
(btw, I did search extensively in this forum and other areas for this, but had a hard time finding an example that would work here)
I'd like to use an array to store a list of names. Then I would like to search the array to see if my name is the last value in the array. In essence, I need to determine if the person currently filling out this form is the last person in a list of names stored in an array. Make sense?
I already have a loop that cycles through controls on the form as shown at the bottom of this post. The array will contain 12 elements maximum, but may not always contain 12.
For example - if the array contains:
{John Doe, Jane Doe, My Name, Josh Doe, Ellen Doe}
After the array is filled, in this case, I need a boolean variable - let's call it - bnLast - to return "FALSE" because "MyName" is NOT the last name in the array.
Can anyone offer a link or some code for this to help me out? I'm terrible with arrays. I am notoriously awful at array usage, so any help with this would be great. My looping code is show below. Just need help adding code in it to fille the array and code after it to tell me if MyName is the last value in the array.
Thanks in advance to anyone who can save me here!
(btw, I did search extensively in this forum and other areas for this, but had a hard time finding an example that would work here)
Code:
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If Left(ctl.Name, 6) = "txtApp" Then
If Not IsNull(ctl.Value) Then 'if textbox is not null
Approver = ctl.Value 'identify value in text box
If Approver = CurApprover Then 'if value matches currently logged in approver
boApproverPresent = True 'tell program that approver is present on the form
Exit For 'exit loop
End If
End If
End If
End If
Next ctl