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.


10 Years
Discussion Span
Last Post by bogenbroom

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.



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,


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?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.