Results 1 to 2 of 2

Thread: error in storing list box values in table

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2002
    Location
    chennai
    Posts
    20

    error in storing list box values in table

    I want to store the listbox values in the database table. So that, i use the code given below. Actually, listbox contains the values like "DD,AA,BB,CC,EE,FF,DD,CC". Totally, there are 8 values in it. If i run the program first time, only 6 values are added. (ie), the repeated values like DD,CC are not added. I have to add those values also. At the same time, when i run the program second time, the eight values which are added first should not be again added to the table. How to do this using vbcode? Please help me.


    for i=0 to list1.listcount-1
    'Attempt to find the entry.
    rs.findfirst "'fnam='" & list1.list(i) & "'"

    'Check if the entry was already found
    if rs.eof then
    rs.addnew
    rs![fnam]=list1.list(i)
    rs.update
    end if
    next i

  2. #2
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    why not just delete all exising records from the table, then add all in the list.

    should be quicker and easier.
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

Posting Permissions

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



Click Here to Expand Forum to Full Width