I have problems with this sort this does not update my records in my database. I can not find what wrong is on it.

I want to sort a table in my database any time the user clcik on a button and answer

Dim dbs As Database
Dim rst As Recordset
Dim rstSort As Recordset
Dim strName As Variant

strName = _
Trim(InputBox("Enter Last Name first letter eg: [A] for Anderson"))
If strName = "" Then Exit Sub

Set dbs = OpenDatabase("C:\Address\Address.mdb")
Set rst = _
dbs.OpenRecordset(strName, _
dbOpenDynaset)

With rst
SortOutput "Original Recordset:", rst
.Sort = "LastName, FirstName"
' Print report showing Sort property and record order.
SortOutput _
"Recordset after changing Sort property:", _
rst
' Open new Recordset from current one.
Set rstSort = .OpenRecordset
' Print report showing Sort property and record order.
SortOutput "New Recordset:", rstSort
rstSort.Close
.Close
End With

dbs.Close

End Sub


Function SortOutput(strTemp As String, _
rstTemp As Recordset)

With rstTemp
Debug.Print strTemp
Debug.Print " Sort = " & _
IIf(.Sort <> "", .Sort, "[Empty]")
.MoveFirst

' Enumerate Recordset.
Do While Not .EOF
Debug.Print " " & !LastName & _
", " & !FirstName
.MoveNext
Loop

End With

End Function

[COLOR=blue][COLOR=blue][COLOR=darkblue][COLOR=darkblue][PHP]