Results 1 to 5 of 5
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i use the sql to select distinct from rset, but the first occurence PROVA3 is null!!!!

    why?

    RSSQLD.Open "SELECT DISTINCT PROVA3 FROM MERCATI WHERE PROVA3 IS NOT NULL AND PROVA1 = '" & Left(Me.COMBO_DISTRETTO, 8) & "' ", CNSQL, adOpenKeyset, adLockReadOnly, adCmdTableDirect

    To test i use:



    RSSQLD.MoveFirst
    For I = 0 To RSSQLD.RecordCount
    Debug.Print (RSSQLD!PROVA3)
    RSSQLD.MoveNext
    Next I

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='sal21' post='768227' date='30-Mar-2009 12:02'][/quote]
    Is there one or more spaces in the first PROVA3 ?
    Francois

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts
    [quote name='sal21' post='768227' date='30-Mar-2009 07:02']RSSQLD.MoveFirst
    For I = 0 To RSSQLD.RecordCount
    Debug.Print (RSSQLD!PROVA3)
    RSSQLD.MoveNext
    Next I[/quote]
    You should check whether or not there are any records in the recordset before you do the above code.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  4. #4
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='MarkLiquorman' post='768252' date='30-Mar-2009 15:50']You should check whether or not there are any records in the recordset before you do the above code.[/quote]
    attached real db...

    string:
    MERCATO_T_3 = Empty
    MERCATO_T_3 = Trim(SESS0.Screen.GetString(10, 15, 8))

    and sql:

    SQL1 = Empty
    SQL1 = "INSERT INTO MERCATI(PROVA1,PROVA2,PROVA3,PROVA4,PROVA5,PROVA6, PROVA7,PROVA8,PROVA9,PROVA10)V
    ALUES('" & MERCATO_T_1 & "','" & MERCATO_T_2 & "','" & MERCATO_T_3 & "','" & MERCATO_T_4 & "','" & MERCATO_T_5 & "','" & MERCATO_T_6 & "','" & MERCATO_T_7 & "','" & TEST_AGENZIA & "','" & DATA_AGG & "','" & DESCR_AT & "')"
    CNSQLST.Execute SQL1

    dubt only if the string is empty...

    is correct trim statement?

  5. #5
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='sal21' post='768326' date='30-Mar-2009 20:57'][/quote]
    I really doubt if you table MERCATI is corrupt, at least the column PROVA3, it's the only in the table.
    Opening the table, it give me 821 records, but looping to read each record in VBA it stop at 104 record.
    Then you have the empty records, they are not NULL, there length is 0, CHR([PROVA3]) give an error.
    It's a mystery for me. Maybe some one else ?
    Francois

Posting Permissions

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