Hope this finds everyone well. Happy New Year!
I'm trying to build a Loop for a set of dropdown menus I'm inserting into a form.
Basically, the client has to be able to select 1 to 20 donors with the dropdown options (member names) pulled from the DB. When the client is editing a donation record, she needs to be able to view the correct donors for a specific donation record selected in the dropdowns. This means matching the Donor IDs in the Donations Table with the Member IDs in the Members table, and then pulling the member's name to display in the dropdown.
Unless I can find a way to loop, I've got to have 20 of these in my code
Below is what the non-incremental, non-loop dropdown looks like:
<div id="donor_1" style="display:inline">
<select name="Donor_ID_1">
<option value="">-- Select the Donor --</option>
<% DO UNTIL MembersInfo.EOF %>
<% strMembersID1 = MembersInfo.Fields("ID") %>
<% intComparison1 = strComp(strMembersID1, strRecord_ID_1) %>
<option <% IF intComparison1 = 0 THEN %>selected<% END IF %> value="<%=MembersInfo.Fields("ID")%>"><%=MembersIn fo.Fields("L_Name")% >, <%=MembersInfo.Fields("F_Name")%> <% IF MembersInfo.Fields("M_Init") <> "" THEN%><%=MembersInfo.Fields("M_Init")%><% END IF %> (User ID: <%=MembersInfo.Fields("ID")%>)</option>
<% MembersInfo.MOVENEXT %>
<% LOOP %>
<% MembersInfo.MOVEFIRST %>
</select> <input type="button" value="+" name="add_donor_1" onClick="toggleBox('donor_2',1);" title="Add an Additional Donor"><br>
</div>
Here's my attempt at a loop...but it's not working:
<%
x = 1
DO WHILE x < 21
%>
<div id="donor_<%=x%>" style="display:inline">
<select name="Donor_ID_<%=x%>">
<option value="">-- Select the Donor --</option>
<% DO UNTIL MembersInfo.EOF %>
<% strMembersID+"&x&" = MembersInfo.Fields("ID") %>
<% intComparison+x = strComp(strMembersID+x, strRecord_ID_+x) %>
<option <% IF intComparison+x = 0 THEN %>selected<% END IF %> value="<%=MembersInfo.Fields("ID")%>"><%=MembersIn fo.Fields("L_Name")% >, <%=MembersInfo.Fields("F_Name")%> <% IF MembersInfo.Fields("M_Init") <> "" THEN%><%=MembersInfo.Fields("M_Init")%><% END IF %> (User ID: <%=MembersInfo.Fields("ID")%>)</option>
<% MembersInfo.MOVENEXT %>
<% LOOP %>
<% MembersInfo.MOVEFIRST %>
</select> <input type="button" value="+" name="add_donor_<%=x%>" onClick="toggleBox('donor_<%=x+1%>',1);" title="Add an Additional Donor"><br>
</div>
<% x = x+1 %>
<% LOOP %>
Any and all help would be greatly appreciated. I feel like I'm just blowing the syntax on appending the incremental integer to the other strings.
Many thanks in advance! Noah