Consulting

Results 1 to 3 of 3

Thread: ORDER RECORDSET BY NULL WITH DAO

  1. #1

    ORDER RECORDSET BY NULL WITH DAO

    Ho to order entire recordset in ANAGRAFICA1 by filed APPELLATIVO where in filed APPELLATIVO is blank?
    move all blank recordset in the top of table, i think ASC
    Note: in table are present 1.202.589 rds

    piece of code:

    [VBA] Set DB2 = DBEngine.OpenDatabase("D:\PUBBLICA\APPLICAZIONI\APPELLATIVI.MDB")
    Set RSD2 = DB2.OpenRecordset("APP")
    Set DB1 = DBEngine.OpenDatabase("D:\PUBBLICA\APPLICAZIONI\ANAGRAFICA_OK_10092007.mdb" )
    Set RSD1 = DB1.OpenRecordset("ANAGRAFICA1")


    RITORNO:

    With RSD1

    Do While Not RSD1.EOF
    If RSD1.Fields("APPELLATIVO") = "" Then
    COPE = RSD1.Fields("COPE")
    Call INSERISCIANAGRAFICA(COPE)
    RSD1.MoveNext
    Else
    RSD1.MoveNext
    End If
    Loop

    End With[/VBA]
    Sal
    1 help 1 pizza
    2 help 1 pizza 1 caff?
    3 help 1 pizza 1 caff? 1 mozzarella
    ...
    Spaghetti, Lasagne and Tortellini for the "Lady" ;-)

  2. #2
    Administrator
    2nd VP-Knowledge Base
    VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    I'm sorry, but I don't get it.

    You are looking to order a recordset by NULL values? If so, you cannot 'ORDER BY' a null column and get any desired results because NULL is 'unknown' data and therefore you would get 'unkown' results. It may never be consistent.

    And what is:
    [vba]Call INSERISCIANAGRAFICA(COPE) '???[/vba]
    Can we see the INSERISCIANAGRAFICA function/sub procedure?
    And you don't use RSD2 in your code so I'm not sure what you are trying to do with it...

    Could you post more of the relevant info from your code? (with some comments, since I can't read Italian [...yet])




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  3. #3
    Administrator
    2nd VP-Knowledge Base VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    Quote Originally Posted by sal21
    move all blank recordset in the top of table, i think ASC
    I'm sorry, I skipped right over that. If you want to put all the NULL values on top, you can execute a query that will do that for you (you were right, ASC):
    SELECT  Column
    FROM Table 
    ORDER BY Column ASC;
    This is assuming there ARE NULL values in your returned data.
    I think you can use that with your recordset rather than looping through the recordset.




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

Posting Permissions

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