Results 1 to 3 of 3

Thread: Empty Rows?

  1. #1
    Join Date
    Sep 2003
    Location
    Calgary
    Posts
    8

    Unhappy Unanswered: Empty Rows?

    This routine display a recordset into a DBGrid but shows empty rows. How can I do to eliminate the empty rows.

    Sub OpenGrid()
    Dim rst As Recordset


    Set rst = db.OpenRecordset("Cities", dbOpenDynaset)
    Set rs = db.OpenRecordset("Country")
    ' Set approximate count value:
    DBGrid1.ApproxCount = MaxRow

    rs.MoveFirst
    With rs
    Do While Not .EOF
    If !Contries = Combo1.Text Then
    CountryCode = !CountryID
    End If
    .MoveNext
    Loop
    End With

    rst.MoveFirst
    With rst
    ' Initialize MyData
    Dim i%, j%
    For j% = 0 To MaxRow - 1
    If .EOF Then
    Exit Sub
    End If
    If CountryCode = rst!CityID Then
    For i% = 0 To MaxCol - 1
    MyData(i%, j%) = rst(i%)
    Next i%
    End If
    .MoveNext
    Next j%

    End With
    End Sub

    Thanks and regards

  2. #2
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    Lightbulb Use distinct

    Set rs = db.OpenRecordset("SELECT DISTINCTROW Cities FROM Country")

  3. #3
    Join Date
    Sep 2003
    Location
    Calgary
    Posts
    8
    Thanks foy your response I will try it.

Posting Permissions

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