Hi friends i would like to know how to get a result in to the text box when i am going to click on any record in the grid the record set has to be shown in to the textboxes just doing double clicking on it i am having the following code which is fetching the records and showing them but when i am clicking on any record its not showing in the textboxes please help me

Code:
Dim cnGlobal As New ADODB.Connection
Dim RsAccess As New ADODB.Recordset
Dim sConnect As String
Private sSQL As String
Private Sub Combo2_Click()
  Dim bItemSelected As Byte
  bItemSelected = Me.Combo2.ListIndex
  Select Case bItemSelected
    Case 0
      Me.Label8.Caption = "Enter The TerminalID"
      Text3.Visible = True
      DTPicker2.Visible = False
    Case 1
      Me.Label8.Caption = "Enter the date "
      Text3.Visible = False
      DTPicker2.Visible = True
    Case 2
      Me.Label8.Caption = "Enter last 4 Digits"
      Text3.Visible = True
      DTPicker2.Visible = False
    Case 3
      Me.Label8.Caption = "Enter last 4 Digits"
      Text3.Visible = True
      DTPicker2.Visible = False
    Case 4
      Me.Label8.Caption = "Enter the Authcode"
      Text3.Visible = True
      DTPicker2.Visible = False
  End Select
End Sub
Code:
Private Sub Command1_Click()
End  ' closes the window
End Sub

Private Sub Command2_Click()
Export MSHFlexGrid1, "Export of Data"
End Sub

Private Sub Command4_Click()
If Option1.Value = False And Option2.Value = False Then
MsgBox "Enter your choice"
Else

    Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset

    With rs
    '---> Change your DSN <-----'
        .ActiveConnection = "Provider=MSDASQL;Driver={MySQL ODBC 5.1 Driver};Server=localhost;Port=3306;Database=worldspace;User=root; Password=password;Option=10;"
        .LockType = adLockOptimistic
        .CacheSize = 1
        .CursorLocation = adUseClient
        .CursorType = adOpenStatic
        If Option1.Value = True Then
                .Source = "Select * from user where address= '" & Combo1.Text & "' and subdate ='" & Format(DTPicker1.Value, "yyyy-mm-dd") & "' "
        End If
        
            If Option2.Value = True Then
            .Source = "select * from localcard"           
          
        
                If Combo2.Text = "Terminalid" Then
                .Source = "Select * from localcard "
                End If

                If Combo2.Text = "trxndate" Then
                .Source = "Select * from localcard  where trxndate='" & Format(DTPicker2.Value, "yyyy-mm-dd") & "'"
                End If

                If Combo2.Text = "FTNumber" Then
                .Source = "Select * from localcard where FTNumber like '%" & Text3.Text & "' "
                End If

                If Combo2.Text = "SessionID" Then
                .Source = "Select * from localcard  where SessionID like '%" & Text3.Text & "'"
                End If

                If Combo2.Text = "Authcode" Then
                .Source = "Select * from localcard "
                End If
           
            End If
            
       .Open
        Call Fill_Grid(rs, Me.MSHFlexGrid1)
        Set .ActiveConnection = Nothing
        Set rs = Nothing
'        rs.Cancel
        
    End With  
End If
End Sub
Code:
Private Sub Command5_Click()
Text1(0).Visible = True
Dim gridRow As Long

    gridRow = IIf(MSHFlexGrid1.Row > 1, MSHFlexGrid1.Row - 1, MSHFlexGrid1.Rows - 1)
    ShowDetails gridRow

End Sub

Private Sub Command6_Click()
Text1(0).Visible = True
Dim gridRow As Long

    gridRow = IIf(MSHFlexGrid1.Row < MSHFlexGrid1.Rows - 1, MSHFlexGrid1.Row + 1, 0)
    ShowDetails gridRow
End Sub
Code:
Private Sub Form_Load()
'Establish Connection
    sConnect = "Provider=MSDASQL;Driver={MySQL ODBC 5.1 Driver};Server=localhost;Port=3306;Database=worldspace;User=root; Password=password;Option=10;"
    cnGlobal.Open sConnect
    Label6.Caption = "Database has been Connected..."
   Timer1.Interval = 100
     Label5.Caption = ""
     Label2.Caption = ""
Me.Label8.Caption = ""
  With Me.Combo2
    .AddItem ("Terminalid")
    .AddItem ("trxndate")
    .AddItem ("FTNumber")
    .AddItem ("SessionID")
    .AddItem ("Authcode")
    .ListIndex = 0
  End With
     sSQL = "SELECT DISTINCT address FROM user" 'Filter Fields with a unique Name
     RsAccess.Open sSQL, cnGlobal
While Not RsAccess.EOF
  Combo1.AddItem RsAccess("address")
  RsAccess.MoveNext ' View all Field Content
Wend
end Sub
Private Sub Timer1_Timer()
Label5.Caption = Time
Label2.Caption = Date
End Sub
Code:
Function Fill_Grid(rs As ADODB.Recordset, _
                   ctr As MSHFlexGrid)
    Dim lCols As Long
    Dim lRows As Long
    Dim lCol As Long
    Dim lRow As Long
    Dim sColor As String
   
    'Check for BOF
    If (Not (rs.BOF)) Then
        'Num of Columns
        lCols = rs.Fields.Count
        With ctr
            .Cols = lCols
            .Row = 0
            'Fill Columns Headers
            For lCol = 0 To lCols - 1
                .Col = lCol
                .Text = rs(lCol).Name
                .ColWidth(lCol) = 1500
            Next
            'Get data
            lRow = 1
        
            Do While Not rs.EOF
                For lCol = 0 To lCols - 1
                    .Col = lCol
                    .Row = lRow
                    .Text = rs.Fields(lCol).Value
                                        
                Next
                 rs.MoveNext
                 lRow = lRow + 1
                .Rows = lRow + 1
            Loop
        End With
    End If
End Function
Code:
'Create a module and write following code :
Public Function Export(FG As MSHFlexGrid, Sname As String)
Static objexc As Object
Static objexcwkb As Excel.Workbook
Static objexcwst As Excel.Worksheet
Dim P As Long
Dim q As Long
Dim newCell As String

Set objexc = CreateObject("Excel.Application")
If Err.Number <> 0 Then
Set objexc = New Excel.Application
Err.Clear
End If
On Error Resume Next
objexc.Visible = False
objexc.DisplayAlerts = False
Set objexcwkb = objexc.Workbooks.Add
Set objexcwst = objexc.ActiveSheet
For P = o To FG.Rows - 1
For q = o To FG.Cols - 1
FG.Row = P
FG.Col = q
newCell = Chr(q + 65) & P + 1
objexcwst.Range(newCell).Value = FG.Text
If Option1.Value = True Then
objexcwst.Range("G:I").NumberFormat = "[$-409]d-mmm-yy;@"
End If
If Option2.Value = True Then

objexcwst.Range("A:A").NumberFormat = "[$-409]d-mmm-yy;@" 'sets the date in the format 24-nov-2008
objexcwst.Range("C:D").NumberFormat = "0"
objexcwst.Range("G:H").NumberFormat = "0.00" 'sets the cost in the format of indian rupees like 34.50
objexcwst.Columns("C:D").ColumnWidth = 18 'sets the column width as 18
End If
Next
Next
objexc.Visible = True
 objexc.DisplayAlerts = True
Set objexc = Nothing
 Set objexcwrk = Nothing
 Set objexcwst = Nothing
End Function
Code:
Public Sub ShowDetails(currentRow As Long)
Dim iCol As Integer
Dim iRow As Integer

 If Label10.UBound > 0 Then
        For iCol = 1 To Label10.UBound
           Unload Label10(iCol)
           Unload Text1(iCol)
        Next iCol
    End If
    
    With MSHFlexGrid1
        For iCol = 0 To .Cols - 1
            If iCol = 0 Then
                Label10(iCol).Caption = .TextMatrix(0, iCol)
                Text1(iCol).Text = .TextMatrix(currentRow, iCol)
            Else
                Load Label10(iCol)
                Load Text1(iCol)
                Label10(iCol).Move Label10(0).Left, _
                                  Text1(iCol - 1).Top + Text1(iCol - 1).Height + 60, _
                                  Label10(0).Width, _
                                  Label10(0).Height
                Text1(iCol).Move Text1(0).Left, _
                                  Text1(iCol - 1).Top + Text1(iCol - 1).Height + 60, _
                                  Text1(0).Width, _
                                  Text1(0).Height
                
                Label10(iCol).Caption = .TextMatrix(0, iCol)
                Text1(iCol).Text = .TextMatrix(currentRow, iCol)
                Label10(iCol).Visible = True
                Text1(iCol).Visible = True
            End If
        Next iCol
        .Row = currentRow
    End With

End Sub