Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data is "zero-length string"?

Status
Not open for further replies.

tyleri

Programmer
Jan 2, 2001
173
US
I have blank form. I am selecting a record from another table, these records are listed in a combo box. When I select one of the records, I am trying to get it to populate the information in the form from another table. I originally had it working fine, but when I moved away from the record, and came back, the data was blank. So I added fields for the data to be imported into the current table, and this almost works, except i get this error:

Field "my field" can't be a zero-length string

What does this mean? If I debug, it brings me to where I reference the column in the combo box like

Box1 = Column1 in VBA

If I click end, it works how I want. How can I turn off these debugging messages telling me that my code is wrong? it works!!!

Thanks
 
Hi,

To be honest, I am a little lost on what you are trying to do, but:

If the value you are storing in the 'control source' for the combo box is a foreign key (ie the primary key for the related table), your fields should be populated as soon as you make the combo selection (if your form is based on a query).

If you just want to display the different columns from the combo box, you can do this by setting the field control source "= yourComboName.column(n)" where n = the ordinal number of the column, starting from 0.

The error message appears to be related to the field setting for your table allowing null values. At a guess the field you are using to set the value in your current record is blank (zero length) and this conflicts with the field setting in the table design (allow zero length = "no" (default)).

Hope this helps

Cheers

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top