PC Review


Reply
Thread Tools Rate Thread

Corrupt/ Bad Recordset

 
 
SSweez@gmail.com
Guest
Posts: n/a
 
      13th Apr 2007
have been experiencing an issue that I just can not figure out.
Please let me know if there might be a more appropriate group to post
this question in. I am using Microsoft Jet OLEDB to retrieve a
recordset from an Access Database over our company network. I use a
"CopyFromRecordset" to write the data to a worksheet in Excel. I
will
often see the data that is imported corrupted. A good bit of the
data
appears dublicated (multiple records that are the same that really
should be uniqe) and sometimes in the wrong columns. Even stranger
is
when data appears in the worng column it only does so for certian
records and not others. If I capture the SQL through a debug.prinnt
and run it directly in Access I get a clean recordset every time.
Does anyone know what the problem might be and how to fix it? Any
help would be greatly appreaciated. Thanks.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWlrZQ==?=
Guest
Posts: n/a
 
      13th Apr 2007
Could you maybe post your code and has it always been this way or has it
worked before


"(E-Mail Removed)" wrote:

> have been experiencing an issue that I just can not figure out.
> Please let me know if there might be a more appropriate group to post
> this question in. I am using Microsoft Jet OLEDB to retrieve a
> recordset from an Access Database over our company network. I use a
> "CopyFromRecordset" to write the data to a worksheet in Excel. I
> will
> often see the data that is imported corrupted. A good bit of the
> data
> appears dublicated (multiple records that are the same that really
> should be uniqe) and sometimes in the wrong columns. Even stranger
> is
> when data appears in the worng column it only does so for certian
> records and not others. If I capture the SQL through a debug.prinnt
> and run it directly in Access I get a clean recordset every time.
> Does anyone know what the problem might be and how to fix it? Any
> help would be greatly appreaciated. Thanks.
>
>

 
Reply With Quote
 
=?Utf-8?B?TWlrZQ==?=
Guest
Posts: n/a
 
      13th Apr 2007
Could you post your code And has this CopyFromRecordset worked correct before

"(E-Mail Removed)" wrote:

> have been experiencing an issue that I just can not figure out.
> Please let me know if there might be a more appropriate group to post
> this question in. I am using Microsoft Jet OLEDB to retrieve a
> recordset from an Access Database over our company network. I use a
> "CopyFromRecordset" to write the data to a worksheet in Excel. I
> will
> often see the data that is imported corrupted. A good bit of the
> data
> appears dublicated (multiple records that are the same that really
> should be uniqe) and sometimes in the wrong columns. Even stranger
> is
> when data appears in the worng column it only does so for certian
> records and not others. If I capture the SQL through a debug.prinnt
> and run it directly in Access I get a clean recordset every time.
> Does anyone know what the problem might be and how to fix it? Any
> help would be greatly appreaciated. Thanks.
>
>

 
Reply With Quote
 
SSweez@gmail.com
Guest
Posts: n/a
 
      13th Apr 2007
On Apr 12, 9:42 pm, Mike <M...@discussions.microsoft.com> wrote:
> Could you post your code And has this CopyFromRecordset worked correct before
>
>
>
> "SSw...@gmail.com" wrote:
> > have been experiencing an issue that I just can not figure out.
> > Please let me know if there might be a more appropriate group to post
> > this question in. I am using Microsoft Jet OLEDB to retrieve a
> > recordset from an Access Database over our company network. I use a
> > "CopyFromRecordset" to write the data to a worksheet in Excel. I
> > will
> > often see the data that is imported corrupted. A good bit of the
> > data
> > appears dublicated (multiple records that are the same that really
> > should be uniqe) and sometimes in the wrong columns. Even stranger
> > is
> > when data appears in the worng column it only does so for certian
> > records and not others. If I capture the SQL through a debug.prinnt
> > and run it directly in Access I get a clean recordset every time.
> > Does anyone know what the problem might be and how to fix it? Any
> > help would be greatly appreaciated. Thanks.- Hide quoted text -

>
> - Show quoted text -

The copyfromrecord set has always worked. As I have been using/
testing the worksheet more I have noticed this intermitant issue. Here
is my code:

dbpath = ThisWorkbook.Names("dbpath").RefersToRange
dbpass = ThisWorkbook.Names("dbpass").RefersToRange
dbdir = ThisWorkbook.Names("dbdir").RefersToRange
sConnect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & dbpath &
"; Jet OLEDBatabase Password = " & "'" & dbpass & "'"
Set adoConn = New ADODB.Connection
adoConn.ConnectionString = sConnect
adoConn.Open
rsSpendData.Open sSQL, adoConn, adOpenForwardOnly, adLockReadOnly
If rsSpendData.EOF Then
rsSpendData.MoveFirst
Sheets("Spend Detail").Range("J27").CopyFromRecordset rsSpendData
Else
Sheets("Spend Detail").Range("J27").CopyFromRecordset rsSpendData
End If


I would post the SQL but it is really long. If I put the SQL directly
in an Access Query it always works.

 
Reply With Quote
 
=?Utf-8?B?TWlrZQ==?=
Guest
Posts: n/a
 
      13th Apr 2007
try this I'm not sure why you have
Sheets("Spend Detail").Range("J27").CopyFromRecordset rsSpendData twice
that could be you dup data


Do While rsSpendData.EOF = False
'If rsSpendData.EOF Then
'rsSpendData.MoveFirst
Sheets("Spend Detail").Range("J27").CopyFromRecordset rsSpendData
'Else
'Sheets("Spend Detail").Range("J27").CopyFromRecordset rsSpendData
'End If
rsSpendData.MoveNext

"(E-Mail Removed)" wrote:

> On Apr 12, 9:42 pm, Mike <M...@discussions.microsoft.com> wrote:
> > Could you post your code And has this CopyFromRecordset worked correct before
> >
> >
> >
> > "SSw...@gmail.com" wrote:
> > > have been experiencing an issue that I just can not figure out.
> > > Please let me know if there might be a more appropriate group to post
> > > this question in. I am using Microsoft Jet OLEDB to retrieve a
> > > recordset from an Access Database over our company network. I use a
> > > "CopyFromRecordset" to write the data to a worksheet in Excel. I
> > > will
> > > often see the data that is imported corrupted. A good bit of the
> > > data
> > > appears dublicated (multiple records that are the same that really
> > > should be uniqe) and sometimes in the wrong columns. Even stranger
> > > is
> > > when data appears in the worng column it only does so for certian
> > > records and not others. If I capture the SQL through a debug.prinnt
> > > and run it directly in Access I get a clean recordset every time.
> > > Does anyone know what the problem might be and how to fix it? Any
> > > help would be greatly appreaciated. Thanks.- Hide quoted text -

> >
> > - Show quoted text -

> The copyfromrecord set has always worked. As I have been using/
> testing the worksheet more I have noticed this intermitant issue. Here
> is my code:
>
> dbpath = ThisWorkbook.Names("dbpath").RefersToRange
> dbpass = ThisWorkbook.Names("dbpass").RefersToRange
> dbdir = ThisWorkbook.Names("dbdir").RefersToRange
> sConnect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & dbpath &
> "; Jet OLEDBatabase Password = " & "'" & dbpass & "'"
> Set adoConn = New ADODB.Connection
> adoConn.ConnectionString = sConnect
> adoConn.Open
> rsSpendData.Open sSQL, adoConn, adOpenForwardOnly, adLockReadOnly
> If rsSpendData.EOF Then
> rsSpendData.MoveFirst
> Sheets("Spend Detail").Range("J27").CopyFromRecordset rsSpendData
> Else
> Sheets("Spend Detail").Range("J27").CopyFromRecordset rsSpendData
> End If
>
>
> I would post the SQL but it is really long. If I put the SQL directly
> in an Access Query it always works.
>
>

 
Reply With Quote
 
SSweez@gmail.com
Guest
Posts: n/a
 
      13th Apr 2007
On Apr 13, 8:51 am, SSw...@gmail.com wrote:
> On Apr 12, 9:42 pm, Mike <M...@discussions.microsoft.com> wrote:
>
>
>
> > Could you post your code And has this CopyFromRecordset worked correct before

>
> > "SSw...@gmail.com" wrote:
> > > have been experiencing an issue that I just can not figure out.
> > > Please let me know if there might be a more appropriate group to post
> > > this question in. I am using Microsoft Jet OLEDB to retrieve a
> > > recordset from an Access Database over our company network. I use a
> > > "CopyFromRecordset" to write the data to a worksheet in Excel. I
> > > will
> > > often see the data that is imported corrupted. A good bit of the
> > > data
> > > appears dublicated (multiple records that are the same that really
> > > should be uniqe) and sometimes in the wrong columns. Even stranger
> > > is
> > > when data appears in the worng column it only does so for certian
> > > records and not others. If I capture the SQL through a debug.prinnt
> > > and run it directly in Access I get a clean recordset every time.
> > > Does anyone know what the problem might be and how to fix it? Any
> > > help would be greatly appreaciated. Thanks.- Hide quoted text -

>
> > - Show quoted text -

>
> The copyfromrecord set has always worked. As I have been using/
> testing the worksheet more I have noticed this intermitant issue. Here
> is my code:
>
> dbpath = ThisWorkbook.Names("dbpath").RefersToRange
> dbpass = ThisWorkbook.Names("dbpass").RefersToRange
> dbdir = ThisWorkbook.Names("dbdir").RefersToRange
> sConnect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & dbpath &
> "; Jet OLEDBatabase Password = " & "'" & dbpass & "'"
> Set adoConn = New ADODB.Connection
> adoConn.ConnectionString = sConnect
> adoConn.Open
> rsSpendData.Open sSQL, adoConn, adOpenForwardOnly, adLockReadOnly
> If rsSpendData.EOF Then
> rsSpendData.MoveFirst
> Sheets("Spend Detail").Range("J27").CopyFromRecordset rsSpendData
> Else
> Sheets("Spend Detail").Range("J27").CopyFromRecordset rsSpendData
> End If
>
> I would post the SQL but it is really long. If I put the SQL directly
> in an Access Query it always works.- Hide quoted text -
>
> - Show quoted text -


Some more info. The sheet I am copying into has a number of hidden
rows and columns that the data will go into. The rows are filtered
using Excel. I created a new sheet and used but the following code in
from of the code above that copies in the "Spend Detail" tab:

sheets("sheet1").range("a1").copyfromrecordset rsspenddata

Strange thing is that the data that went into the new sheet was fine
but the data that was copied into the "Spend Detail" sheet was still
"corrupt." When I compared the two sets of data 21 of the 630 records
were different. The records that come in different (actually they are
duplicate records that should not be there) seem to happen at random.

 
Reply With Quote
 
=?Utf-8?B?TWlrZQ==?=
Guest
Posts: n/a
 
      13th Apr 2007
I'm not really sure what to do about the hidden rows and columns sorry

"(E-Mail Removed)" wrote:

> On Apr 13, 8:51 am, SSw...@gmail.com wrote:
> > On Apr 12, 9:42 pm, Mike <M...@discussions.microsoft.com> wrote:
> >
> >
> >
> > > Could you post your code And has this CopyFromRecordset worked correct before

> >
> > > "SSw...@gmail.com" wrote:
> > > > have been experiencing an issue that I just can not figure out.
> > > > Please let me know if there might be a more appropriate group to post
> > > > this question in. I am using Microsoft Jet OLEDB to retrieve a
> > > > recordset from an Access Database over our company network. I use a
> > > > "CopyFromRecordset" to write the data to a worksheet in Excel. I
> > > > will
> > > > often see the data that is imported corrupted. A good bit of the
> > > > data
> > > > appears dublicated (multiple records that are the same that really
> > > > should be uniqe) and sometimes in the wrong columns. Even stranger
> > > > is
> > > > when data appears in the worng column it only does so for certian
> > > > records and not others. If I capture the SQL through a debug.prinnt
> > > > and run it directly in Access I get a clean recordset every time.
> > > > Does anyone know what the problem might be and how to fix it? Any
> > > > help would be greatly appreaciated. Thanks.- Hide quoted text -

> >
> > > - Show quoted text -

> >
> > The copyfromrecord set has always worked. As I have been using/
> > testing the worksheet more I have noticed this intermitant issue. Here
> > is my code:
> >
> > dbpath = ThisWorkbook.Names("dbpath").RefersToRange
> > dbpass = ThisWorkbook.Names("dbpass").RefersToRange
> > dbdir = ThisWorkbook.Names("dbdir").RefersToRange
> > sConnect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & dbpath &
> > "; Jet OLEDBatabase Password = " & "'" & dbpass & "'"
> > Set adoConn = New ADODB.Connection
> > adoConn.ConnectionString = sConnect
> > adoConn.Open
> > rsSpendData.Open sSQL, adoConn, adOpenForwardOnly, adLockReadOnly
> > If rsSpendData.EOF Then
> > rsSpendData.MoveFirst
> > Sheets("Spend Detail").Range("J27").CopyFromRecordset rsSpendData
> > Else
> > Sheets("Spend Detail").Range("J27").CopyFromRecordset rsSpendData
> > End If
> >
> > I would post the SQL but it is really long. If I put the SQL directly
> > in an Access Query it always works.- Hide quoted text -
> >
> > - Show quoted text -

>
> Some more info. The sheet I am copying into has a number of hidden
> rows and columns that the data will go into. The rows are filtered
> using Excel. I created a new sheet and used but the following code in
> from of the code above that copies in the "Spend Detail" tab:
>
> sheets("sheet1").range("a1").copyfromrecordset rsspenddata
>
> Strange thing is that the data that went into the new sheet was fine
> but the data that was copied into the "Spend Detail" sheet was still
> "corrupt." When I compared the two sets of data 21 of the 630 records
> were different. The records that come in different (actually they are
> duplicate records that should not be there) seem to happen at random.
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Binding a form to a disconnected recordset and making it capable to update such recordset Yarik Microsoft Access 2 22nd Nov 2006 02:18 AM
Binding a form to a disconnected recordset and making it capable to update such recordset Yarik Microsoft Access Form Coding 2 22nd Nov 2006 02:18 AM
Access 2002: bind adodb recordset to listbox recordset property Craig Buchanan Microsoft Access Form Coding 2 1st May 2005 12:14 AM
How to loop through a recordset and update the field of a recordset or delete current record Karen Middleton Microsoft Access Macros 1 4th Jan 2005 10:30 AM
How to loop through a recordset and update the field of a recordset or delete current record Karen Middleton Microsoft Access Queries 1 4th Jan 2005 10:30 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:35 PM.