Results 1 to 3 of 3
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    'Option Explicit
    Private Sub Form_Load()

    Dim lRow As Long
    Dim lCol As Long, CONTA_REC As Long

    Show

    Call open_conn

    SSQL = "Select TIPO_MERCATO, TIPO_DISTRETTO,DATA_RIEPILOGO,SITUAZ_AL,TOP_RAPP,T OP_UTILIZZ FROM RIEPILOGO WHERE LEFT(TIPO_MERCATO,4)='8505' ORDER BY TIPO_MERCATO"
    Set RSSQL2 = CNSQL1.Execute(SSQL)

    CONTA = RSSQL2.RecordCount

    RSSQL2.MoveFirst

    With MSFlexGrid

    .Row = 0
    .Col = 0
    .Text = "AREA"
    .Col = 1
    .Text = "MERCATO"
    .Col = 2
    .Text = "DISTRETTO"
    .Col = 3
    .Text = "DATA AGG."
    .Col = 4
    .Text = "SIT. AL"
    .Col = 5
    .Text = "NR. RAPP."
    .Col = 6
    '.Text = "UTILIZZATO"
    ' .Col = 7
    ' .Text = "UTILIZZATO"
    ' .Col = 8
    ' .Text = "SONFINAMENTO"
    ' .Col = 9
    ' .Text = "GG"

    'CONTA = 0

    'Y = 1

    For Y = 1 To CONTA


    .TextMatrix(Y, 0) = Left(RSSQL2!TIPO_MERCATO, 4)
    'error here after second next y
    .TextMatrix(Y, 1) = Trim(RSSQL2!TIPO_DISTRETTO)
    .TextMatrix(Y, 2) = Trim(RSSQL2!DATA_RIEPILOGO)
    .TextMatrix(Y, 3) = Trim(RSSQL2!SITUAZ_AL)
    .TextMatrix(Y, 4) = Trim(RSSQL2!TOP_RAPP)
    .TextMatrix(Y, 5) = Trim(RSSQL2!TOP_UTILIZZ)
    ' .TextMatrix(Y, 6) = arrResults(23, I)
    ' .TextMatrix(Y, 7) = arrResults(19, I)
    ' .TextMatrix(Y, 8) = arrResults(20, I)
    ' .TextMatrix(Y, 9) = arrResults(24, I)'
    RSSQL2.MoveNext
    'CONTA = CONTA + 1
    Next Y

    End With

    End Sub

    i want to fill flex grid with rset but have error!!!

    note the first line of flex grid is the tile of column.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    What is the error number?
    What is the text of the error message?
    What is the value of TIPO_DISTRETTO when the error occurs?

  3. #3
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts
    CONTA = RSSQL2.RecordCount will always return 1.

    You need to do a RSSQL2.MoveLast to populate the recordset to get a correct recordcount.
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

Posting Permissions

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