I edit one of the text boxes that represents a field in my database and hit the save button that contains this code. The only record that gets updated is the first row of the database. None of the others, when I make another edit again only the first row. Can someone tell me if some of my code is bad. Thanks
Private Sub CmdSave_Click()
Dim rs As ADODB.Recordset
Dim Ssql As String
conn = "Provider=SQLOLEDB.1;Password=admin;Persist Security Info=True;UserID=tk;Initial Catalog=pubs;Data Source=ZSPOTK"
Set rs = New ADODB.Recordset
Ssql = "Select * from publishers Where country = '" & Text5.Text & "'"
rs.Open Ssql, conn, adOpenKeyset, adLockOptimistic, adCmdText
If rs.EOF = True Then
rs.MovePrevious
End If
If rs.bof= True Then
rs.movenext
End If
rs!Pub_name = Text1
rs!city = Text2
rs!State = Text3
rs!country = Text4
rs.Update
rs.Close
End Sub aspvbwannab
Private Sub CmdSave_Click()
Dim rs As ADODB.Recordset
Dim Ssql As String
conn = "Provider=SQLOLEDB.1;Password=admin;Persist Security Info=True;UserID=tk;Initial Catalog=pubs;Data Source=ZSPOTK"
Set rs = New ADODB.Recordset
Ssql = "Select * from publishers Where country = '" & Text5.Text & "'"
rs.Open Ssql, conn, adOpenKeyset, adLockOptimistic, adCmdText
If rs.EOF = True Then
rs.MovePrevious
End If
If rs.bof= True Then
rs.movenext
End If
rs!Pub_name = Text1
rs!city = Text2
rs!State = Text3
rs!country = Text4
rs.Update
rs.Close
End Sub aspvbwannab