Data type conversion error when saving numeric data types 
Author Message
 Data type conversion error when saving numeric data types

I have a textbox which is bound to an Access database field (numeric data
type).
If I type a digit into the box, then the record can be saved ok.  If I
remove the digit again and try to save the record, then I get a data type
conversion error.
Does anyone know a way around this, so that if a user blanks the box, then
the record can be saved, and the box remains blank?

I know I can do this in an Access form, but can not seem to just blank the
box in a VB form.

Even 'text1 = val(text1)' just puts a zero in the box, but I do not want a
setting of zero if the user wants no setting to be printed.

Any help would be very much appreciated, as this has been bugging be for a
while now.

Thanks

Ed



Wed, 04 Sep 2002 03:00:00 GMT
 Data type conversion error when saving numeric data types

I believe that was one of the items corrected in Visual Studio SP3 about
null variables in databases. If you don't have SP3 installed, give that a
shot. I am assuming you have VB6 Professional or above.
--
Craig Luecke
Technical Information Specialist / Webmaster
Fairfax County International Urban Search and Rescue
WEB: http://www.vatf1.org


Quote:
> I have a textbox which is bound to an Access database field (numeric data
> type).
> If I type a digit into the box, then the record can be saved ok.  If I
> remove the digit again and try to save the record, then I get a data type
> conversion error.
> Does anyone know a way around this, so that if a user blanks the box, then
> the record can be saved, and the box remains blank?

> I know I can do this in an Access form, but can not seem to just blank the
> box in a VB form.

> Even 'text1 = val(text1)' just puts a zero in the box, but I do not want a
> setting of zero if the user wants no setting to be printed.

> Any help would be very much appreciated, as this has been bugging be for a
> while now.

> Thanks

> Ed



Wed, 04 Sep 2002 03:00:00 GMT
 Data type conversion error when saving numeric data types
I already have SP3 installed, and am using VB6.  Will try re-installing SP3.
Thanks very much for the help Craig  :o)

Ed



Wed, 04 Sep 2002 03:00:00 GMT
 Data type conversion error when saving numeric data types
Ed,
You might want to check Access to see if your column allows Nulls. Haven't
used Access for a few years so I don't know how it currently works with
"Nullable" columns. You might want to put a break in your code to see
exactly what VB is attempting to insert into the table.

Oscar Bowyer

Quote:

>I have a textbox which is bound to an Access database field (numeric data
>type).
>If I type a digit into the box, then the record can be saved ok.  If I
>remove the digit again and try to save the record, then I get a data type
>conversion error.
>Does anyone know a way around this, so that if a user blanks the box, then
>the record can be saved, and the box remains blank?

>I know I can do this in an Access form, but can not seem to just blank the
>box in a VB form.

>Even 'text1 = val(text1)' just puts a zero in the box, but I do not want a
>setting of zero if the user wants no setting to be printed.

>Any help would be very much appreciated, as this has been bugging be for a
>while now.

>Thanks

>Ed



Wed, 04 Sep 2002 03:00:00 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. Btrieve Numeric Data Types and Microsoft Visual Basic 5 or 6 Data Types

2. conversion of ODBC SQL data types to ODBC C data types

3. Disallowed implicit conversion from data type nvarchar to data type money

4. Arithmetic overflow error converting numeric to data type numeric

5. Type Mismatch while using Activex Script Task with numeric data type

6. Data Transfer from Long data type to SQL Server Text data type column

7. ADO Text Driver forces Numeric Type on field containing string and numeric data

8. Error in ADO2.1 and Sybase Data Type Numeric (16,4)

9. Error converting data type varchar to numeric

10. Microsoft ADO and Sybase - Numeric Data Type Cause Error

11. Precision Error in SQL Numeric data type

12. Error converting data type varchar to numeric.


 
Powered by phpBB® Forum Software