![]() |
Decimal problem
In my registration form I've a textbox for writing the quantity.
The corresponding controlsource cell in the spreadsheet where my figures are collected, is set to "General Number" format. The reason is that the quantity sometimes can be without or with 1, 2 or 3 decimals. I save my registration lines to a small Excel database and have the possibility to retrieve my registred line again at a later time. If I copy a line containing a value with decimals and in general format, to the spreadsheet and then load the form, Excel will hang! If it's an integer or I set the cell to number format with fixed decimals, it works fine. Can this be solved? |
Decimal problem
You may try setting the format as 'Text'.
"Mats Samson" wrote: In my registration form I've a textbox for writing the quantity. The corresponding controlsource cell in the spreadsheet where my figures are collected, is set to "General Number" format. The reason is that the quantity sometimes can be without or with 1, 2 or 3 decimals. I save my registration lines to a small Excel database and have the possibility to retrieve my registred line again at a later time. If I copy a line containing a value with decimals and in general format, to the spreadsheet and then load the form, Excel will hang! If it's an integer or I set the cell to number format with fixed decimals, it works fine. Can this be solved? |
Decimal problem
I tried it and it will work, but not properly, I believe!
I didn't test it fully through but it seems I still will end up in problems. If the value is treated as pure text it cannot be used as a part of the calculation, Quantity x Price = Salesvalue. Furthermore there is the problem with localisation, as I'm Swedish, my computer is localised to Swedish numerics, using comma as decimal delimiter, not period. Excel doesn't work well in a mixed situation as Forms textboxes defaults to period delimiter and not knowing when it has to convert a number or not, it will be a big mess. I can't use text for numerics in my calculation program, that would be asking for more trouble. In fact I discovered the problem to be even more complex and posted a new message about it tonight. I believe there is a fault in either WindowsXP or Office2003/Excel behaviour when localisation is involved together with Textboxes. "JNW" wrote: You may try setting the format as 'Text'. "Mats Samson" wrote: In my registration form I've a textbox for writing the quantity. The corresponding controlsource cell in the spreadsheet where my figures are collected, is set to "General Number" format. The reason is that the quantity sometimes can be without or with 1, 2 or 3 decimals. I save my registration lines to a small Excel database and have the possibility to retrieve my registred line again at a later time. If I copy a line containing a value with decimals and in general format, to the spreadsheet and then load the form, Excel will hang! If it's an integer or I set the cell to number format with fixed decimals, it works fine. Can this be solved? |
Decimal problem
So maybe format the worksheet to accept 10 decimals (I know that's a lot, but
hold on). Then in the afterupdate event for the text box put something to count the number of non-zeros after the decimal point and adjust the number format accordingly. It seems a select case statement would work best. I just don't know how to count non-zeros after a decimal point. "Mats Samson" wrote: I tried it and it will work, but not properly, I believe! I didn't test it fully through but it seems I still will end up in problems. If the value is treated as pure text it cannot be used as a part of the calculation, Quantity x Price = Salesvalue. Furthermore there is the problem with localisation, as I'm Swedish, my computer is localised to Swedish numerics, using comma as decimal delimiter, not period. Excel doesn't work well in a mixed situation as Forms textboxes defaults to period delimiter and not knowing when it has to convert a number or not, it will be a big mess. I can't use text for numerics in my calculation program, that would be asking for more trouble. In fact I discovered the problem to be even more complex and posted a new message about it tonight. I believe there is a fault in either WindowsXP or Office2003/Excel behaviour when localisation is involved together with Textboxes. "JNW" wrote: You may try setting the format as 'Text'. "Mats Samson" wrote: In my registration form I've a textbox for writing the quantity. The corresponding controlsource cell in the spreadsheet where my figures are collected, is set to "General Number" format. The reason is that the quantity sometimes can be without or with 1, 2 or 3 decimals. I save my registration lines to a small Excel database and have the possibility to retrieve my registred line again at a later time. If I copy a line containing a value with decimals and in general format, to the spreadsheet and then load the form, Excel will hang! If it's an integer or I set the cell to number format with fixed decimals, it works fine. Can this be solved? |
All times are GMT +1. The time now is 12:23 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com