Advertisement

07.23.2008 at 02:46AM PDT, ID: 23587848
[x]
Attachment Details

Strange behaviour with ADO Recordset

Asked by Ignis2000 in SQL Server 2005, Microsoft Excel Spreadsheet Software

Tags: ADO 2.7, SQL Server 2005, Excel 2003 VBA

I have a subroutine which copies data from a recordset into a range. I wrote this to avoid using CopyFroMRecordset as that function doesn't allow you to change the columns in the target area. This function takes the name of the column from the heading and gets the value by a rds.fields(<Name>).

Has been working quite well all this while (few months) and now I've run into a strange error. For some fields alone, it gives a NULL value when referred to by name like this:

rngCopy.Cells(intRow, intIx) = rds.Fields(varCols(1, intIx)) ' = Null

On the Immediate window

?rds.fields("fkIssuer")
Null
?rds.Fields(0).name
fkIssuer
?rds.fields(0)
20

It gives a null value when referred to by name and the real value when referred to by ordinal! Anyone else have this problem??

Am stumped!

Thanks guys!!Start Free Trial
[+][-]07.23.2008 at 02:48AM PDT, ID: 22067445

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 02:50AM PDT, ID: 22067462

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 02:53AM PDT, ID: 22067474

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 02:59AM PDT, ID: 22067497

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 03:06AM PDT, ID: 22067526

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 03:17AM PDT, ID: 22067581

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 03:20AM PDT, ID: 22067602

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: SQL Server 2005, Microsoft Excel Spreadsheet Software
Tags: ADO 2.7, SQL Server 2005, Excel 2003 VBA
Sign Up Now!
Solution Provided By: Ignis2000
Participating Experts: 2
Solution Grade: A
 
 
[+][-]07.23.2008 at 03:42AM PDT, ID: 22067700

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628