Add check box to output, then select - how???

Results 1 to 2 of 2

Thread: Add check box to output, then select - how???

  1. #1
    Join Date
    Dec 1969

    Default Add check box to output, then select - how???

    We have created an output from Access and Frontpage. We now need to be able to add a "check box"/Select box to allow the user to then select the item they want. Then once selected, need to be able select those items check and create a file from that output. In otherwords, I dont know how to associate a check box with an output from a query on a web page and then take that associated check box (which the user has either selected or not selected). Take the selected and pull that data off and create a I have been at Frontpage/database/ASP programming new for about 4 hours...<BR>

  2. #2
    Join Date
    Dec 1969

    Default Well, after about 4 MONTHS...;d be better equipped to handle this. Not sure how you can expect to tackle ANY technology as complex as ASP in only 4 hours. <BR><BR>One of the problems you have is FrontPage. It&#039;s not the best choice for creating ASP pages (fine for HTML pages) and it sometimes will actually obscure things that should be easy.<BR><BR>Anyway, this isn&#039;t hard in ASP, but given that you are using FP and given that you are a rank newbie, I doubt you will understand the explanation at first. But here goes:<BR><BR>One way to do a task like this is to have one checkbox per record and give all the checkboxes the *SAME NAME*. Then the value of each checkbox is the value of the PRIMARY KEY of the record in the DB. (And if you don&#039;t have a primary key for each record, you&#039;ve got a bad table design to start with. If you don&#039;t have a better idea for a PK, then add an AUTONUMBER field to your table in Access and use it as the PK.)<BR><BR>So the code ends up looking *something* like this:<BR><BR>&#060;%<BR>...<BR>Do Until RS.EOF<BR>%&#062;<BR> &#060;INPUT Type=Checkbox Name=Choice Value="&#060;%=RS("primaryKeyFieldNameWhateverItIs ")%&#062;" &#062;<BR> ... output whatever fields you want to show user to enable<BR> ... him/her to make a choice of this record ...<BR>&#060;%<BR> RS.MoveNext<BR>Loop<BR>%&#062;<BR><BR>**********<B R><BR>Then, on the page that the &#060;FORM&#062; from the above submits to, you simply do:<BR><BR>&#060;%<BR>&#039; list of user choices comes in as comma-space delimited list<BR>choices = Request("Choice")<BR>SQL = "SELECT * FROM yourTableName WHERE primaryKeyFieldName IN (" & choices & ")"<BR><BR>Set RS = yourConnection.Execute( SQL )<BR>... dump out the relevant records ...<BR>%&#062;<BR><BR>If your PK field is *NOT* a number, then you have to change that a bit:<BR><BR>&#060;%<BR>&#039; comma-space replaced by apostrophe-comma-apostrophe<BR>choices = "&#039;" Replace( Request("Choice"), ", ", "&#039;,&#039;" ) & "&#039;"<BR>SQL = "SELECT * FROM yourTableName WHERE primaryKeyFieldName IN (" & choices & ")"<BR>...<BR>%&#062;<BR><BR>Yes, this is covered in one of the ASPFAQs on this site:<BR><BR><BR>So... Study all that stuff. Go read all the ASPFAQs. Not so you will remember them but just so that when the next question arises you might say "oh, wait...that&#039;s in the FAQs". And *DO* download and READ the VBScript documentation from Microsoft! You can find the downloadable docs by starting at<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts