You'll need to be thinking fairly creatively about how you make the interface for it, but the theory is pretty simple.
Here's a quick example of how you might
like to do it.
Have a form with checkboxes which are dynamically created, then on submission, it goes through all those checkboxes.
<form method=post action="<% Request.ServerVariables("ScriptName") %>">
'Grab the customer ID from a queryString
CustomerID = Request.QueryString("CustomerID")
Set Rs = Server.CreateObject("ADODB.RecordSet")
sSQl = "SELECT ServiceID, ServiceDescription FROM tblService ORDER BY ServiceDescription"
Rs.Open sSQL, sConnStr, 3, 1
If Not Rs.EOF Then
aServiceList = Rs.GetRows()
For iRowLoop=0 To UBound(aServiceList, 2) %>
<label for="chk<% =aServiceList(1, iRowLoop) %>" >
<% =aServiceList(1, iRowLoop) %></label>
<input type="checkbox" name="chk<% =aService(1, iRowLoop) %>" id="chk<% =aService(1, iRowLoop) %>" value="True">
<% Next 'iRowLoop
Set Rs = Nothing
<input type="hidden" name="ID" value="<% =CustomerID %>">
<input type="submit" value="Edit" name="CService"></form>
If Not IsEmpty(Request.Form("CService")) Then
For Each f in Request.Form
If Left(f,3) = "chk" And Request.Form(f) = "True" Then
Rs.Open "SELECT ServiceID FROM tblService WHERE name='" & Mid(f, 4) & "'", sConnStr, 3, 1
If Not Rs.EOF Then
iTemp = Rs(0)
Rs.Open "tblCustomerServices", sConnStr, 1, 3, &H0002
Rs("ServiceID") = iTemp
Rs("CustomerID") = sID
Naturally, I haven't tested this code, so there's bound to be an error or two in it
Notice also, that this will not display the services the customer has subscribed to.
To do that, you'd need the initial query to also return whether or not there's already a value.
That's a fairly intricate query, however. Using UNIONS, and the like.
If you want it, let me know.
I am a loud man with a very large hat. This means I am in charge