Error on a form

  • Thread starter Thread starter Ramone
  • Start date Start date
R

Ramone

I'm asking for help with the following issue:
I have a table with 10 records when i scroll through and
add record 11 I get the following error message

Field tblInput.expense type' can't be a zero-lenght
string.

I think it is error number 3315.

When record 11 is added I would like the cursor to move
to the first text box and not show this error. Also I
don't want to advance to record 12 unless the first 3
text boxes on record 11 are filled in.

Thanks for any help
 
A zero-length string (ZLS) is a value most commonly entered by typing:
""
into a field. If you have not typed such an entry, open the table in design
view, and make sure you don't have that in the DefaultValue property of the
field Expense Type.

A ZLS is not the same as a Null - the value when no entry has been made. You
could solve your problem by changing the Allow Zero Length property of
Expense Type to Yes (in table design view). However, I would advise against
doing that. To the user there is no visible difference between a ZLS and
Null, so it is generally a confusing interface. Programmatically you have to
test for both conditions in every query and every piece of code in your
application. And not even Access itself can tell the difference properly,
e.g. DLookup() gets it wrong and reports Null when a field contains a ZLS.

So, the best idea would be to make these changes in table design:
1. Set Allow Zero Length to No for all text fields.
2. Make sure you don't have "" in the Default Value property.
3. Set the Required property to Yes for the first 3 fields.
 
Thanks Allen, your suggestions worked great
-----Original Message-----
A zero-length string (ZLS) is a value most commonly entered by typing:
""
into a field. If you have not typed such an entry, open the table in design
view, and make sure you don't have that in the DefaultValue property of the
field Expense Type.

A ZLS is not the same as a Null - the value when no entry has been made. You
could solve your problem by changing the Allow Zero Length property of
Expense Type to Yes (in table design view). However, I would advise against
doing that. To the user there is no visible difference between a ZLS and
Null, so it is generally a confusing interface. Programmatically you have to
test for both conditions in every query and every piece of code in your
application. And not even Access itself can tell the difference properly,
e.g. DLookup() gets it wrong and reports Null when a field contains a ZLS.

So, the best idea would be to make these changes in table design:
1. Set Allow Zero Length to No for all text fields.
2. Make sure you don't have "" in the Default Value property.
3. Set the Required property to Yes for the first 3 fields.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.




.
 
Back
Top