Excel Macro to Compare Database to Sheet

Microsoft Excel 2003 (full product)
July 7, 2010 at 11:21:42
Specs: Windows XP
Hi all,
I've written a macro which connects to Database and compares almost 500 fields which are present in an XL sheet, with a value in database. I've looped through the cells and compared each value with the field.

for i=2 to numofrows
select * from table1 where field1=cells(i,1);

This approach is taking more time.
Can i use something like this ?
select * from table1 where field1 between (range1 to range2);

pls let me know.. Its very urgent.

Thanks in advance

See More: Excel Macro to Compare Database to Sheet

Report •

July 7, 2010 at 12:36:38
Depending on the database, the spreadsheet, and relationship thereof, it might be faster to just load the entire table into a recordset, then pair records and rows from there. You might also try selecting the columns you care about, instead of every column.

Report •

July 7, 2010 at 23:37:49
I have to compare all the records that i fetched. So can i write sql query using between(range1 to rangen) in VBA macro ??

Report •

Related Solutions

Ask Question