Consulting

Results 1 to 2 of 2

Thread: updating record in excel VBA

  1. #1

    Angry updating record in excel VBA

    Hi.
    I have a userform that I can send data too and I can also return data back to that userform once someone does a search for it.

    If that entry then changes. How do I send it back to Access as the same record but editted rather than making a new record?

    Dim cn As ADODB.ConnectionDim rs As ADODB.Recordset
    Set cn = New ADODB.Connection
    Set rs = New ADODB.Recordset
    cn.Open "Provider=Microsoft.ACE.OLEDB.12.0; " & "Data Source=G:\Test DB\test.accdb;"
    searchstring = "SELECT User, Number, Status FROM Claims WHERE [Number]= '" & txtFind.Text & "'"
    rs.Open searchstring, cn, adOpenStatic
    txtName.Text = rs.Fields("User")
    txtClaim.Text = rs.Fields("Number")
    txtStatus.Text = rs.Fields("Status")
    If rs.EOF Then
    MsgBox "          " & txtFind.Value & vbNewLine & "          not Found", vbOKOnly, "Number not Found!"
    End If
    Set rs = Nothing
    End Sub
    is the code i use to bring the information back into the UF.. I dont want to create a new entry just edit and update the one already in the database and im Stuck.

  2. #2
    ADMIN - please feel free to delete.. I spotted my error

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •