With a click in a treeview the records populate a datagrid. Each record has 3 fields; an ID, Title and length. When a record is clicked in the datagrid three
text boxes are filled with the data for editing. There are 2 areas of concern:
1. When the datagrid is clicked the first time the first record is the one that shows up in the textboxes. If the record is clicked twice the correct record is displayed in the textboxes.
2. If the record has an apostrophe, a BOF/EOF error msg appears even though there is a replace statement.
My code for the datagrid:
Is the datagrid the best way to display the info or should I use the flexgrid?
Andy ideas would be great. thanx.
text boxes are filled with the data for editing. There are 2 areas of concern:
1. When the datagrid is clicked the first time the first record is the one that shows up in the textboxes. If the record is clicked twice the correct record is displayed in the textboxes.
2. If the record has an apostrophe, a BOF/EOF error msg appears even though there is a replace statement.
My code for the datagrid:
Code:
Dim sName As String
sName = datagrid1.Text
sName = Replace(datagrid1.Text, "'", "")
sSql = "SELECT TrackID, Title, Length FROM tblTracks WHERE Title = '" & sName & "'"
If rst.State = adStateOpen Then rst.Close
rst.Open sSql, cn, adOpenForwardOnly, adLockReadOnly, adCmdText
txtTrack.Text = rst.Fields("TrackID").Value & ""
txtTitle.Text = rst.Fields("Title").Value & ""
txtLength.Text = rst.Fields("Length").Value & ""
Andy ideas would be great. thanx.