icekalt
asked on
Empty field problem
Hi,
I'm novice at Delphi and have been thrown in the deep end, but perhaps someone has a solution.
I have a set of database edit boxes (DBEdit) and their contents get posted to an Access Database. However, if the operator does not enter any data in them, the following error is given when the contents are posted to the db: 'Key violation. You tried to assign the Null value to a variable that is not a Variant data type.'. I did indicate in the Access database that these fields aren't required and can have zero length.How do I fix this?
Kind regards,
Icekalt.
I'm novice at Delphi and have been thrown in the deep end, but perhaps someone has a solution.
I have a set of database edit boxes (DBEdit) and their contents get posted to an Access Database. However, if the operator does not enter any data in them, the following error is given when the contents are posted to the db: 'Key violation. You tried to assign the Null value to a variable that is not a Variant data type.'. I did indicate in the Access database that these fields aren't required and can have zero length.How do I fix this?
Kind regards,
Icekalt.
It sounds like you are trying to assign a null value to a primary key. Even if you have it set to not be required and allow null values it has to have data entered into it. Set the field where it is not a primary key and it should work. I usually use an autonumber for the key and get past this problem.
Rich
Rich
ASKER
Hi,
Well, the primary key for the table is an autonumber field, and I indicated that the other columns are not required and may have zero length.
I wonder... perhaps Access requires something to be typed in a row before the key for the row is created.
Icekalt
Well, the primary key for the table is an autonumber field, and I indicated that the other columns are not required and may have zero length.
I wonder... perhaps Access requires something to be typed in a row before the key for the row is created.
Icekalt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Rich