visual basic update record while retaining old data
Posted on 2003-10-21
I have a listbox that I am wanting to add to a database field
I want the data in the listbox to look like this:
the listbox data looks like this:
A vbcrlf will have to be added to make the text go to the next line in the access database.
this is what I have but it is not retaining the data in that field.
For i = 0 To lstWindows3.ListCount - 1
If TheCount > 0 Then
'it exists so update if necessary
Dim objCon As New ADODB.Connection, s As String, rs As Recordset
objCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "C:\windows\data.mdb; Jet OLEDB:Database Password="
s = "update tablename set Field1= '" & lstWindows3.List(i) & "' where field1= '" & txtname & "'"
Set objCon = Nothing
if I do this
s = "update tablename set Field1= '" & lstWindows3.List(i) & vbcrlf & lstWindows3.List(i-1) &"' where field1= '" & txtname & "'"
this does this
This would not work. Can anyone figure this out please