CuriousGeorg
02-20-2014, 07:39 AM
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.
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.