Solved

GetRows(), Part 2

Posted on 2013-11-23
2
343 Views
Last Modified: 2013-11-23
Is there a way to use GetRows() on this...I am concerned with filtering out the records that are blank but not null:

    i = 0
    ReDim AsgndBibs(0)
    Set rs = New ADODB.Recordset
    sql = "SELECT pr.Bib FROM PartRace pr INNER JOIN RaceData rd ON pr.RaceID = rd.RaceID WHERE rd.EventID = "
    sql = sql & lEventID & " AND pr.Bib IS NOT NULL ORDER BY pr.Bib"
    rs.Open sql, conn, 1, 2
    Do While Not rs.EOF
        If Not rs(0).Value & "" = "" Then
            AsgndBibs(i) = rs(0).Value
            i = i + 1
            ReDim Preserve AsgndBibs(i)
        End If
        rs.MoveNext
    Loop
    rs.Close
    Set rs = Nothing

Open in new window

0
Comment
Question by:Bob Schneider
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 39671347
You'd be better to adapt your SQL query to filter out the blanks first, rather than pulling the results and filtering afterwards.

Change you where clause to:
sql = sql & lEventID & " AND (pr.Bib IS NOT NULL AND RTRIM(pr.Bib) = '') ORDER BY pr.Bib"

Open in new window

Then you can simply call GetRows() on the resulting recordset.
0
 

Author Closing Comment

by:Bob Schneider
ID: 39671352
Thanks!
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question