You have to find out why it stopped at line 14 - is there any data in rs("eftn")

Maybe replace line 14 with:
if rs("eftn") <> "" then
temp= rs("eftn")
else
temp="---"
end if

when I take away this
dim temp as string it will not work
but when just dim temp
it works and the temp contain eftn

So what sort of data is contained in rs("eftn")?
and does your program now as you want it to?

the data in rs("eftn") contains surename
and the rs("eftn") is function all over
in serveral places
the program find the data

this line

If Not Len(Trim(entry)) = 0 Then LstData3.AddItem entry & "      " & temp

is working that the entry data is rs("email")
and temp is the rs("eftn")
in the same list they work perfectly

I don't understand what you mean by rs("eftn") is function

no its not a function

look this way

If Not Len(Trim(rs("email"))) = 0 Then LstData3.AddItem rs("email") & " " & rs("eftn")

this code works like this

ledan@comhem.se    andersson

in the listbox named lstdata3
but my inteion is to seperat the
email adress and the surename
to 2 diffrent listboxes
and sort them acording to the lstdata3
so i got ledan@comhem in one listbox and the name in the other listbox
because that in the lstdata I can
select several email adress and send them to a Email client
but the surename is coming with it

If dim temp as string doesn't work you are returning not a string from your database? Check the properties of the column eftn in the database. Also maybe try this and check what error msg you get:

If Not Len(Trim(entry)) = 0 Then
LstData3.AddItem entry & temp
List1E.AddItem temp
end if

this is what I got after the new suggestion
look at picture ( imagelist4)

can you open your database with ms access and make sure you got the data in there you want?

yes I can and the data is there.

  entry = rs("email")
      temp = rs("eftn")
     'If Not Len(Trim(rs("email"))) = 0 Then LstData3.AddItem rs("email")
    ' If Not Len(Trim(rs("email"))) = 0 Then List1E.AddItem rs("eftn")
     'If Not Len(Trim(rs("email1"))) = 0 Then List2e.AddItem rs("namn")
   'LstData3.AddItem rs("email")
    If Not Len(Trim(entry)) = 0 Then LstData3.AddItem entry & temp
    List1E.AddItem temp

and this is what I get imagelist5

Switch all the sorting in your listboxes off. Line 8 will not work like this. It is like I showed you or you have to use:
If Not Len(Trim(entry)) = 0 Then LstData3.AddItem temp

after all this work it's so simple

Thanks a lot for all your time

it works just fine

So tell me what was wrong

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.