hi i have been able to update a database using the following code
Option Explicit
Dim conn As ADODB.Connection, rec1 As ADODB.Recordset
Dim esql1 As String
Private Sub Command1_Click()
On Error GoTo 2
If Text1 = "" Then
Command1.Visible = False
Command2.Visible = True
Exit Sub
End If
rec1.AddNew
rec1.Fields(1) = Text1
rec1.Update
GetText
Exit Sub
2
MsgBox ("Duplicate Value")
End Sub
Private Sub Form_Load()
Set conn = New ADODB.Connection
Set rec1 = New ADODB.Recordset
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\shnd\Project.mdb;Persist Security Info=False"
conn.Open
esql1 = "select * from Header"
rec1.Open (esql1), conn, adOpenDynamic, adLockOptimistic
GetText
End Sub
Private Sub GetText()
Do While Not rec1.EOF
List1.AddItem rec1.Fields(1)
rec1.MoveNext
Loop
End Sub
The only problem i am havin is that after clicking the update command the listbox displays the new data twice.. it has to do it once