473,545 Members | 2,058 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with CopyFromRecords et Access>Excel

2 New Member
Apologies in advance for this newbie question!

I have an Access form with an unbound embedded Excel chart on it(Called, OLEUnbound39) (Done on Access form by Insert > Object > Microsoft excel chart)
I would like to place some records in to the underliing sheet and display the chart of this data using VBA.
I use CopyFromRecords et. The code runs and the records are copied to the sheet, but apparently after this copy and before the next line in the code I get the following Error:

Run-time error ' -2147417851 (80010105)':
Method 'CopyFromRecour dset' of object 'Range' failed

This also happens if I change the recordset in a table recordset or if i copy not all the record or fields from the recordset.
The fields that are coupied are nothing special really (number autonumber, date and text fields)

Has anybody got any idea why i get the error and what I can do about it.
Both access and Excel on PC are 2003

Thanks

Code:

Private Sub Command40_Click ()
Dim myWorkBook As Object
Dim myWorkSheet As Object
Dim myChart As Object
Dim db As DAO.Database
Dim rst As DAO.Recordset

Dim frm As Form

Set db = CurrentDb

Set myWorkBook = Me.OLEUnbound39 .Object
Set myChart = myWorkBook.Shee ts("chart1")
Set myWorkSheet = myWorkBook.Shee ts(2)

Set rst = Me.Weight.Form. RecordsetClone
rst.MoveFirst
myWorkSheet.Act ivate
'myWorkSheet.Ra nge("A20").Copy FromRecordset rst, rst.RecordCount - 1, rst.Fields.Coun t - 1
myWorkSheet.Cel ls(2, 1).CopyFromReco rdset rst 'THIS LINE GIVES THE ERROR
rst.Close
myChart.SetSour ceData Source:=myWorkS heet.Range("A1: B6"), PlotBy:=xlRows

End Sub
Dec 9 '07 #1
1 3412
il0postino
2 New Member
So, I discovered that if I open excel manually from the start menu and minimalize it then returning to the access window and click the command button I do not get the error.

But, strangely, when i do get the error (so without the excel "trick") and click "end" on the error message, then open excel like discribed above and again click the button I do get the error.

So once I get the error access seems to "remember" this fact.

If I open excel with VBA in the code it does not prevent the error.

Still puzzelled!
Anybody any idea ?
Thanks
Dec 10 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1386
by: Bryan Harrington | last post by:
Hello all.. I've got a table of data that PHB wants to be able to download to excel to run pivot tables on. No problem.. got all that working.. the catch though is that there is a column in the data that shows the Invoice Date, next column shows the Invoice Month and Year in the format of mmm-yy. Works great in the browser.. when you...
2
2125
by: ExDelphi | last post by:
Hi All I am fairly new to VB.Net, and have gotten stuck with an invoicing application. My database (Access 2000 / 2003) is used to store records of our products, customers, suppliers etc. The user can select customer details which form the proposal / invoice header. The user can also select certain products which can be added to the proposal...
3
2062
by: Gerry Blais | last post by:
Newbie questions: Suppose abc.xls has sheets a, b, c. How can I find, in Python, the sheet names? Given a sheet name, how can I export the sheet as a csv file? Finally, how can I, in Python, make a .txt version of a Word document?
10
5567
by: Mark Day | last post by:
Hi All, I am using Access 2000 to generate over 40 Excel charts and pivot tables using early binding to the Excel 9.0 object library. I am finding that if I show the Excel object while processing the charts, the whole process completes in around 2 minutes. However if I hide the Excel object the same process takes around 27 minutes to...
2
1616
by: Peter Malling | last post by:
The output from a HTML formmail gives a mail with the data for one record in this form: _ID=<Unique ID> <field1>=<value1> <field2>=<value2> .... Some fields might be undefined. How do I convert this to a database format (Access/Excel)?
4
1683
by: Chuck | last post by:
Hello, I have an Access XP database that has several fields. One of the fields is a text field and has an account number that is preceeded by a text character, like: F102354. Every account number has this prefix and is always followed by a 6 digit number. What I need to do is to drop the character at the beginning and keep the remaining...
2
1279
by: Japi | last post by:
My question is this: I have an access database with final numerical values and I'd like to link those results with an excel datasheet. I'd like to create a boton "compute" in the access document so that when clicking it, the excel datasheet will be opened and the valours will automatically be pasted in determinated cells. Could you...
1
1707
by: setterst | last post by:
I am quite new to VBA and Access, but I am trying to figure out how to export specific values from a table in Access, so I can save it in a given cell in Excel. I have been able to figure out how to open and modify cells in my spreadsheet, but I don't understand how to select elements of the Access table to export it to Excel. Here is what I...
3
2132
by: kenduron | last post by:
Hello together, I simply want to export table data to a new excel file without saving this file to local hard disk drive, the user should decide where to store. Alltogether, the excel sheet should only exist in memory Thanks, Karsten
0
7470
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7405
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7659
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7428
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7760
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5334
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4949
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3455
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
709
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.