Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003

    Unanswered: Advanced Programming Question?

    My program read a relational database I have a combo box and an unbound DBGrid. The purpose is to read the master table from the combo and display the detail table in the grid. Well everything is working good my program does very good ecept when I read diferent record from the combo the DBGrid does no change the previous records displayed into the grid, that means the previous records still into the grid. Question, how can I made change the grid to shows only the record that has been selected from the combo. Here is the routine:

    Private Sub cboTrans_Click()
    Call OpenGrid
    End Sub

    Sub OpenGrid()

    Dim rsD As Recordset
    Dim strSQL As String
    Dim RecID As Integer

    Set rsD = DB.OpenRecordset("AccDetail", dbOpenDynaset)
    ' Set approximate count value:
    DBGrid1.ApproxCount = MaxRow

    With rsM
    Do Until .EOF
    If !Trans = cboTrans.Text Then
    RecID = !AccID
    End If
    End With

    With rsD
    ' Initialize MyData
    Dim i%, j%
    For j% = 0 To MaxRow - 1
    If .EOF Then
    Exit Sub
    End If
    If RecID = rsD!AccID Then
    For i% = 0 To MaxCol - 1
    MyData(i%, j%) = rsD(i%)
    Next i%
    End If
    Next j%
    End With

    End Sub

    Thanks for your help

  2. #2
    Join Date
    Jul 2003
    Amsterdam, Nederland

    Cool Hi there

    If you put the code only in the click it will change the grid only with a click on the combobox

    call your procedure in the cboTrans_change

    Private Sub cboTrans_change()
    Call OpenGrid
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts