Discussion Locked

Populating a combo box

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'm using vb6 with an ADODC control.

When the following code is run it comes up with an error saying
Field 'tblStock.Supplier' cannot contain a zero length string.

With adoStock.Recordset
cboSupplier.Clear
While Not .EOF
cboSupplier.AddItem .Fields("Supplier")
.MoveNext
Wend
End With

It breaks on the .MoveNext line.
All I'm trying to do is put the results in a combo box.

6 replies

by sergey kovzik

check your Supplier field to have "Allow Zero Length"=Yes and "Required"=Yes and "Default Value"="" - it may be necessary to go through database and insert empty spaces in this column if it was equal to Null.

Sincerely, Sergey
Brainbench MVP forWin98 Administration

by donq

I suspect cboSupplier.Clear is your culprit, and not the .MoveNext command. The "Field" linked to cboSupplier does not allow a zero length string (or possibly a null value). Try resetting the Field property first to see if your existing code wouldthen alloy users to re-populate cboSupplier????

Good Luck.

by craig shepherd

All the cboSupplier.Clear does is clears all the list values.
I want to do this because I am just about to populate it.
It gets populated on form load.

This discussion is closed to new replies.