Results 1 to 8 of 8

Thread: error updating access database using visual basic

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Location
    india, mysore
    Posts
    11

    Question error updating access database using visual basic

    hi everybody
    i am trying to access a database and update the changes..
    Here is the code...
    Code:
    Option Explicit
    Dim c As New adodb.Connection
    Dim cn As New adodb.Connection
    Dim cm As adodb.Command
    Dim rsnew2 As New adodb.Recordset
    Dim rsnew3 As New adodb.Recordset
      
    Private Sub cmd_close_Click()
    Unload.me
    End Sub
     
    Private Sub cmd_edit_Click()
    rsnew3.Open "select * from company", c, adOpenDynamic, adLockOptimistic
    If text1.Text = "" Then
    MsgBox " enter the company name"
    text1.SetFocus
    rsnew3.Fields("text1") = text1.Text
     End If
    If text2.Text = "" Then
    MsgBox " enter the company address"
    text2.SetFocus
    rsnew3.Fields("text2") = text2.Text
    End If
    rsnew3.Update
    MsgBox " add new successful ", vbInformation, "successful"
     
    End Sub
     
    Private Sub Form_Load()
    Dim cs As String
    c.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\COMION.MDB;Persist Security Info=False")
    rsnew2.Open "select * from company", c, adOpenDynamic
    Me.text1.Text = rsnew2(2)
    Me.text2.Text = rsnew2(3)
     
    End Sub
    I am getting message that "edit is successful", but its not updating in database..
    What should i do ????
    Last edited by Hack; Feb 26th, 2008 at 07:31 AM. Reason: Added Code Tags

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