Here's my problem.
I have a form in which a Microsoft Hierarchical Flex Grid (fgdCompany) is used to display records taken from a database to relevant textboxes on the same form.
When a record from fgdCompany is clicked, then the data in that record is shown on the textboxes.
I have a button called cmdUpdate which should do the following when clicked :
Once, the record is displayed on the text boxes, a change could be made to it.
And when cmdUpdate is clicked it should save the changes it made to that record and display the new updated record on fgdCompany.
My problem is, it always saves the changes made to the first record in fgdCompany. Not the record I want to be changed.
Please help me..... Code used for cmdUpdate is given below.
Dim rsCompany As New ADODB.Recordset
Dim cn As New ADODB.Connection
Dim strSQL As String
cn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & App.Path & "\Luckshan Tours & Travels.mdb;" & _
"Persist Security Info:False"
strSQL = "SELECT [Company].* FROM [Company]"
rsCompany.Open strSQL, cn, adOpenStatic, adLockPessimistic
rsCompany.Fields("Address") = txtAddress
rsCompany.Fields("Telephone Numbers") = txtTelephoneNo
rsCompany.Fields("Vehicles Registered") = txtVehiclesReg
MsgBox "Changes Saved."
Set fgdCompany.DataSource = rsCompany