+ Reply to Thread
Results 1 to 4 of 4

ADOdb not selecting correct data within Date Range

  1. #1
    Registered User
    Join Date
    09-14-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    17

    ADOdb not selecting correct data within Date Range

    I am using a ADOdb connection to import specific columns of data within a user-defined date range from 4 seperate tabs in another Excel file. For example: Start Date is selected by user. End Date is selected by user. File is selected by user. All data within the date range is pulled from "Granulation" tab, "Blending" tab, "Compression" tab, and "coating" tab. The error: Currently this macro is pulling rows of data outside of the date range and ignoring some data that is within the date range. It does not appear to be an issue with the source file...I have tried to copy/paste values into a seperate file to eliminate date format issues, but it still pulls data outside defined range. Error data frequently is associated only with dates beginning with 1 (January, October, November, December) despite selecting otherwise.

    Please review the macro and let me know if there are any issues OR a simpler way to achieve result.

    Thank you,
    Mark

    Date Range begin is entered in R2C1. Date Range end is entered in R2C2. Source file is entered in R2C4.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: ADOdb not selecting correct data within Date Range

    the last few lines seem to imply that your dates are stored as text and not dates which probably explains the behavior you see-the comparison is made on a textual basis and not a date one
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    09-14-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: ADOdb not selecting correct data within Date Range

    I agree with you. But the cell Type = 1 (a value) on the source file. The actual contents of the cell is a vlookup on a date table. Those dates on the table are values as well.

    Does the connection create a recordset of text values only? Is there a way to prevent the recordset from converting date to text? Sorry for the non-expert description.

    Thanks for your help.
    Mark
    Last edited by mvgoggans; 10-15-2012 at 02:13 PM.

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: ADOdb not selecting correct data within Date Range

    do you have any cells in that column that do not return dates? I reckon something is causing Excel to treat the column as text - blank cells or formulas returning errors or "" could do that

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1