Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Oct 2002
    Location
    Houston, Texas, USA
    Posts
    303
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Save data from listbox (2003)

    I have a form that i created and now I wanted to add a listbox with 10 option items. I need to know how I go about saving the checked items to a database. do I create 1 field (NET1) in the database or 10 different items for each one that might be checked. At this time I use the following to save the other fields:

    ' Access side Outlook side
    Rst.fields("jobnum") = UserProperties.Find("jobnum").Value
    Rst.fields("name") = UserProperties.Find("name").Value
    Rst.fields("sitename") = UserProperties.Find("sitename").Value
    Rst.fields("dname") = UserProperties.Find("dname").Value
    Rst.fields("Net1") = UserProperties.Find("Net1"). Value

    I wanted to be able to save all the checked items into one field if possible.

    Thank you

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Save data from listbox (2003)

    "Good" database design is to create a separate table with a record for each selected item.

    If you want to keep everything in the same table as the other fields, I wouldn't create 10 fields. Instead, you could create a text field, and concatenate the selected items, separated by commas or semicolons:

    "Option1,Option3,Option8"

    Downside is that you must parse the string if you want to retrieve the individual items.

  3. #3
    3 Star Lounger
    Join Date
    Oct 2002
    Location
    Houston, Texas, USA
    Posts
    303
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Save data from listbox (2003)

    I had in my original form each item as checkboxs. Management said they didn't like the way it looked they wanted a listbox because it looked better. Of course, it was mentioned that I was the designer and had finaly say on it. But, that one of the VP's suggested that it would look better the otherway.

    Thanks... Think I will try to keept it my way and just try to make it look like a listbox.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Save data from listbox (2003)

    You could use a multi-select list box or a series of check boxes. That doesn't have to influence the database design. Both can be accomodated with 10 separate fields or with one field with concatenated values or with a separate table.

Posting Permissions

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