Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default Error - Method 'CopyFromRecordset' of object 'Range' failed

A few things you can try:

1. Is it possible that the recordest is empty?
2. Is it possible that the recordset contains 65536 records?
3. Are any of the fields in the recordset strings, and if so are they 255
characters long?

"marko" wrote:

I am trying to retrieve data from a query in an Access 97 database and
populate Sheets in an Excel 2002 workbook using 'CopyFromRecorset'.

The problem i am having is that 2 out of the 7 Sheets (all sheets are being
populated one after the other within the same piece of code) are creating the
'Method 'CopyFromRecordset' of object 'Range' failed' error message and i
can't understand why? (If it was something to do with my programming sure all
sheets would fail!!)

Has anyone else come across this problem? If so, is there an answer to it?

Any help will be greatly appreciated

Mark

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Error - Method 'CopyFromRecordset' of object 'Range' failed

Thanks for the reply Sam.

Unfortunately all the suggestion below are covered.

There seems to be no logic as such behind why this happens.
The sheet that is populated prior to the failure returns 37k rows, the sheet
the error appears on still gets populated after Oking the error but with less
records than expected (4k rows & should return 24k rows).



"Sam Wilson" wrote:

A few things you can try:

1. Is it possible that the recordest is empty?
2. Is it possible that the recordset contains 65536 records?
3. Are any of the fields in the recordset strings, and if so are they 255
characters long?

"marko" wrote:

I am trying to retrieve data from a query in an Access 97 database and
populate Sheets in an Excel 2002 workbook using 'CopyFromRecorset'.

The problem i am having is that 2 out of the 7 Sheets (all sheets are being
populated one after the other within the same piece of code) are creating the
'Method 'CopyFromRecordset' of object 'Range' failed' error message and i
can't understand why? (If it was something to do with my programming sure all
sheets would fail!!)

Has anyone else come across this problem? If so, is there an answer to it?

Any help will be greatly appreciated

Mark

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default Error - Method 'CopyFromRecordset' of object 'Range' failed

If it only populates 4000 rows then there must be something on row 4001 that
it doesn't like.

You may have to compare the results in the query in Access to find out what
the next record should be. I still thing it might be a string of length 255
characters, in which case you'll need to make that field the last one
returned for each record.

"marko" wrote:

Thanks for the reply Sam.

Unfortunately all the suggestion below are covered.

There seems to be no logic as such behind why this happens.
The sheet that is populated prior to the failure returns 37k rows, the sheet
the error appears on still gets populated after Oking the error but with less
records than expected (4k rows & should return 24k rows).



"Sam Wilson" wrote:

A few things you can try:

1. Is it possible that the recordest is empty?
2. Is it possible that the recordset contains 65536 records?
3. Are any of the fields in the recordset strings, and if so are they 255
characters long?

"marko" wrote:

I am trying to retrieve data from a query in an Access 97 database and
populate Sheets in an Excel 2002 workbook using 'CopyFromRecorset'.

The problem i am having is that 2 out of the 7 Sheets (all sheets are being
populated one after the other within the same piece of code) are creating the
'Method 'CopyFromRecordset' of object 'Range' failed' error message and i
can't understand why? (If it was something to do with my programming sure all
sheets would fail!!)

Has anyone else come across this problem? If so, is there an answer to it?

Any help will be greatly appreciated

Mark

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Error - Method 'CopyFromRecordset' of object 'Range' failed

Thanks again Sam,

Took you advise and checked the query and it turns out that there is a
Divide By 0 Error on that column.

"Sam Wilson" wrote:

If it only populates 4000 rows then there must be something on row 4001 that
it doesn't like.

You may have to compare the results in the query in Access to find out what
the next record should be. I still thing it might be a string of length 255
characters, in which case you'll need to make that field the last one
returned for each record.

"marko" wrote:

Thanks for the reply Sam.

Unfortunately all the suggestion below are covered.

There seems to be no logic as such behind why this happens.
The sheet that is populated prior to the failure returns 37k rows, the sheet
the error appears on still gets populated after Oking the error but with less
records than expected (4k rows & should return 24k rows).



"Sam Wilson" wrote:

A few things you can try:

1. Is it possible that the recordest is empty?
2. Is it possible that the recordset contains 65536 records?
3. Are any of the fields in the recordset strings, and if so are they 255
characters long?

"marko" wrote:

I am trying to retrieve data from a query in an Access 97 database and
populate Sheets in an Excel 2002 workbook using 'CopyFromRecorset'.

The problem i am having is that 2 out of the 7 Sheets (all sheets are being
populated one after the other within the same piece of code) are creating the
'Method 'CopyFromRecordset' of object 'Range' failed' error message and i
can't understand why? (If it was something to do with my programming sure all
sheets would fail!!)

Has anyone else come across this problem? If so, is there an answer to it?

Any help will be greatly appreciated

Mark

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error 1004 Method 'Range' of object '_Global' failed bjwade62 Excel Programming 4 August 7th 06 03:57 PM
Run-time error '1004': Method 'Range' of object '_Global' failed Neild Excel Programming 0 February 12th 06 11:43 PM
Run-time error '1004': Method 'Range' of object '_Global' failed Tim Williams Excel Programming 2 February 12th 06 10:01 PM
Range Question / error 1004: method Range of object Worksheet has failed Paul Excel Programming 3 April 7th 05 02:56 PM
<Method 'Range' of object '_Global' failed error Ken Loomis Excel Programming 2 October 12th 04 01:29 PM


All times are GMT +1. The time now is 12:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"