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. Get error: Disallowed implicit conversion from data type varchar to data type money

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

3. Data Type Conversion Error when creating table in VBA

4. Data Type Conversion Error ?

5. Data Type Conversion Error

6. HELP Data Type Conversion Error

7. Data Type Conversion error question

8. Data Type Conversion Error

9. FIX: Data Type Conversion Error

10. Data type conversion error

11. Data type conversion error

12. data type conversion error

 

 
Powered by phpBB® Forum Software