Access Multiple checkbox insert

Results 1 to 2 of 2

Thread: Access Multiple checkbox insert

  1. #1
    Join Date
    Dec 1969

    Default Access Multiple checkbox insert

    I have 3 tables in a database<BR><BR>Categories<BR>Contacts<BR>And a Contact and Categories join table which only contains two columns a ContactID and CategoryID<BR><BR>There is a many to many relationship many contacts fall into one category and many categories belong to one contact<BR><BR>My form is set up so that when someone adds a new Contact there are about 20 checkboxes one for each category in the database.<BR><BR>I need to INSERT all of the contacts info into the CONTACTS table when the form is submitted and I need to insert the contactID and categoryId into the join table. <BR><BR>The way my form is set up the checkboxes all have the same name, "categoriesChecked", and the values for the checkboxes are determined by a categoryID recordset: <BR><BR>&#060;input type=""checkbox"" name=""categoriesChecked"" value="& LinkID & """&#062;<BR><BR>I&#039;m using ASP and Microsoft Access. I need help with the SQL statement for this. I dont know how to Loop through the checkboxes to insert them into the database. Should I make two seperate SQL statements? Any help would be greatly appreciated. <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Access Multiple checkbox insert

    i&#039;m assuming, then, that when you do<BR><BR>response.write request.form("categoriesChecked")<BR><BR>you&#039; ll get a comma seperated (it may be comma-space seperated-my memory isn&#039;t up to much this morning.).<BR><BR>split this to an array;<BR><BR>arr=split(request.form("categoriesCh ecked"), ",") &#039;as i said, may be ", ".<BR><BR>for i = 0 to uBound(arr)<BR><BR> &#039;you then have the &#039;value&#039; of the checkbox (LinkID)<BR> &#039;which you can use to update your db.<BR><BR>next<BR><BR><BR><BR>cp

Posting Permissions

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