I am exporting the data from ms access to excel where the error displays as Run-time error -2147467259(8000 04005)
Method 'Copyfromrecord set' of object 'Range' faild.
Ws.Range("A2"). CopyFromRecords et rs
One of my Field Name, DATATYPE is set to MEMO
I am testing with DATATYPE As TEXT and the Characters within 255 then the report get's downloaded to Excel, if the DATATYPE is set to MEMO and the characters are more than 255 error dispalys as explained above.
.......iam using the below code - .
-
Dim strmsg As String
-
Dim DB As Database
-
Dim Qd As QueryDef
-
Dim rs As Recordset
-
Dim Ws As Object
-
Dim i As Integer
-
Dim FirstDate As String
-
Dim LastDate As String
-
Dim Status As String
-
Dim mypath As String
-
Dim WB As Workbook
-
-
-
Set DB = CurrentDb()
-
Set Qd = DB.QueryDefs("Database Reports Query")
-
-
Set rs = Qd.OpenRecordset()
-
-
Set WB = Workbooks.Add
-
Set Ws = Sheets("Sheet1")
-
Range("A1").Select
-
-
For i = 0 To rs.Fields.Count - 1
-
Ws.Cells(1, i + 1).Value = rs.Fields(i).Name
-
-
Next
-
-
Ws.Range(Ws.Cells(1, 1), Ws.Cells(1, rs.Fields.Count)).Font.Bold = True
-
Ws.Range("A2").CopyFromRecordset rs
-
-
Sheets("Sheet1").Select
-
Range("A1").Select
-
Selection.CurrentRegion.Select
-
Selection.Columns.AutoFit
-
Range("A1").Select
-
-
Me.cboStartDate.Value = ""
-
Me.cboEndDate.Value = ""
-
Me.Status_Reports_up_to_date.Value = ""
-
-
strmsg = strmsg & "Report downloaded successfully...!!!"
-
If MsgBox(strmsg, vbOKOnly, "Reports!") = vbOK Then
-
End If
-
-
WB.Close
-
Qd.Close
-
rs.Close
-
DB.Close
---------------------
Kindly help me....
Ananth
3 2543 NeoPa 32,573
Recognized Expert Moderator MVP
I'm afraid that the answer is almost certainly that it cannot handle memo fields of length >255.
I think you probably already suspected that, but I can't give you any better news :(
Memo fields in Access are accepting more than 255 characters but when it downloads to Excel using the above code... Error displaying as mentioned above.
Kindly help.
Ananth
NeoPa 32,573
Recognized Expert Moderator MVP
I do understand the problem Ananth, I am simply saying that it is a limitation. Memo fields are limited in so many ways.
Having just run a test with a simple Export though, I can say this transfers the data across ok.
I may get some spare time later to try out a version of your code (We are not a code-fixing service by the way) to see if the .CopyFromRecord set() function has this built-in restriction. Having checked your code visually though, other than assuming that this function would handle this when maybe it doesn't, there seems to be nothing wrong with the effective part of it.
PS. Please do not vent your frustration by shouting (posting in all caps). This is not allowed on this site for fairly obvious reasons, and repetition will surely trigger an official site warning. -Administrator.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: sridevi |
last post by:
Hello
How to export data from ms-access database to excel worksheet using ASP.
mainly i need to export data to multiple worksheets. it is very urgent to
us.
i have a sample code which works only exporting to single worksheet. but i
need to export data to multiple worksheets.
it is very urgent to us. so please help me in code.
|
by: D |
last post by:
I've created a report with many subreports of aggregate data. I want my
client to be able to export this data to Excel to make her charts, etc. Only
one problem: one of the fields is a "SchoolYear" TEXT field that contains
data such as 2000/01, 2001/02, etc. If I export a Query with this kind of
data to Excel, it gives me the text value of this field; however, when I
export a Report bound to this TEXT field, Excel gives me the values 36526,...
|
by: G |
last post by:
When I export data from access to excel by with "export" or "Analyze
with" I seem to loose parts of some fields (long text strings). Is
there a way to export it all to excel?
Thanks
G
|
by: Mustufa Baig |
last post by:
I have an ASP.NET website where I am showing off crystal reports to users by
exporting them to pdf format. Following is the code:
----------------
1 Private Sub ExportReport()
2 Dim oStream As System.IO.MemoryStream =
3 myReport.ExportToStream(
ExportFormatType.PortableDocFormat)
4 Response.Clear()
5 Response.Buffer() = True
|
by: bobh |
last post by:
Hi All,
In Access97 I have a table that's greater than 65k records and I'm
looking for a VBA way to export the records to Excel.
Anyone have vba code to export from access to excel and have the code
use multiple excel tabs within a workbook????
Anyone have vba code that would create a temp table write 65,000
records to it, export those to excel, clean the temp table, append the
next 65,000 records, export it to excel with a different...
| |
by: John Overton |
last post by:
I have a new requirement to Import and Export Excel tables into and out of Access 2003. The Excel tables are located on a remote server but I know the path to the Excel Files.
Can you please help me with the Access VBA code I need to perform these Importing and Exporting tasks??
Sincerely,
John Overton
|
by: jennwilson |
last post by:
Access 2000 - I have developed a database that houses patient information. The patient information must be sent in an excel file to another company department. I know how to export my data to Excel where it ends up in individual cells (Rows/Colums, etc). I would like for the report that I am exporting to Excel to transfer like a pdf. file. and be similar to the report generated in the database. Kind of like a snapshot of the report, is this...
|
by: accessvbanewbie |
last post by:
I keep getting an error stating OBJECT VARIABLE OR WITH BLOCK VARIABLE NOT SET.
This error just recently began to happen.
I am exporting some records to excel into a preformatted report.
The records are exported successfully but this error pops up before the export is completed.
When I run the debugger this line gives the error message(OBJECT VARIABLE OR WITH BLOCK VARIABLE NOT SET)
If Not (rsSchedules.EOF = True) Then
Below is my...
|
by: geolemon |
last post by:
Import text wizard says:
I'm banging my head on this one, here's why:
I've been importing files using this process and data format, with success!
I created a temporary table in Access to facilitate my import process (It's all text columns, I perform transformations later).
And I created a template in Excel to correspond to the table - essentially it's just column headers:
In Excel, I've been opening files of work that we've done...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |