Click to See Complete Forum and Search --> : ADO Control Question


Jules Needleman
August 4th, 1999, 11:27 PM
I am creating a recordset within my VB6 program using the ADO control.

I would like to append fields of variable length strings.

Could someone provide sample code of this.

Currently, this is a sample of my code:

r.Fields.Append "Field1", adChar, 25
r.Fields.Append "Field2", adChar, 14
r.Fields.Append "Field3", adChar, 255
r.Fields.Append "Field4", adChar, 25
r.Fields.Append "Field5", adChar, 25
r.Fields.Append "Field6", adChar, 25

This code works, but the fields are of fixed lengths.

If I change the code to the following, I get a runtime error when trying to
sort the field.

r.Fields.Append "Field1", adBSTR

r.Sort "Field1"

The error message is "The requested order could not be opened"

I would like to be able to sort a variable length string.

Is that possible?

If so, how would I create the recordset so that this would work?

Any help would be greatly appreciated.

Thanks

Lothar Haensler
August 5th, 1999, 02:02 AM
did you try that adVarChar property I mentioned yesterday?

Jules Needleman
August 5th, 1999, 09:10 AM
I tried it, but get the runtime error
"The requested order could not be opened"

when I try to do a sort.

r.Sort = "Field"

If I go back and replace the append with

r.Fields.Append "Field1", adChar, 25

I do not get the runtime error.

Any ideas?