Forums
This topic is locked
Convert Checkboxes to text with commas
10 Jun 2003 23:33:46 Al Patel posted:
I am trying to something that seems very simple, but I can't figure it out. I have a form that has a group of checkboxes. For example, Jan, Feb, March, April, etc... (each as a checkbox). I write the Y/N values of each of these fields to an Access database.What I want to do next is where I am stuck. I need to spit out the checkboxes that were selected (Y value or whatever it needs to be), in text format with commas seperating them.
So for example, If checkboxes for April, July, December are selected. Then I would like to print:
'April, July, December'
on another web page when I query the DB. How do I do this? How do I also put a comma to seperate the months, and no comma before the first value and after the last?
Some direction would be greatly appreciated...
Replies
Replied 12 Jun 2003 23:12:11
12 Jun 2003 23:12:11 Brad Hitt replied:
Create a recordset on that page.
"SELECT * FROM table WHERE CheckedMonth = True"
Then print the results on the page with a loop.
<% Do While Not rs.EOF
Response.Write(rs.Fields("CheckedMonth") & ","
Loop
%>
"SELECT * FROM table WHERE CheckedMonth = True"
Then print the results on the page with a loop.
<% Do While Not rs.EOF
Response.Write(rs.Fields("CheckedMonth") & ","
Loop
%>