Hi,
I am using the following syntax in VB 6.0 to copy distinct values from strTableName to TableName

strOpen = "Select distinct * into" & " " & strDupTableName & " from " & strTableName
rst.Open strOpen, db, adOpenDynamic, adLockOptimistic

But I am getting a runtime error "-2147217833". I have 900 records in the table and all the fields are set to type "memo".

Please help me to resolve this error.

Regards,
Dinil

I have seen this before using VBScript & Access (I don't use VB much). That error usually indicates either a data type issue or a field length issue. Sounds like you have the data type covered. Check the field length in the source & destination fields to make sure that you aren't potentially trying to put data that is too large for the field into the destination.

Hi,

I am able to sucessfully delete duplicate records when the number of records are few in number say=50. But the same code is not working when the number of records are many say=500 or more.

Please help,
Dinil

Sorry about that - had a momentary lapse of reason. Forgot for a moment that you specified field length by setting type to memo.

Sounds like for troubleshooting you may want to step through the recordset one by one to find the offending record(s), then you can inspect that individual record to determine why it failed. I still think there may be a schema difference between the 2 tables causing some grief. Perhaps a field in the source table that allows zero-length data while the corresponding destination field doesn't?

Thanks all...
the error is solved now.

what fixed it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.