3) I don't understand the need for cstr() function. I thought the .value stored by a textbox control was String.
I thought the same when I tested my code for the post.
My test scenario was this
-
Create a form with 2 textboxes and a checkbox
-
Set the default value for one of the textboxes to 10
-
enter code ( without cstr() )
-
into the after update event of the other textbox
-
Run form and enter 10 into the second textbox
-
I set the default value to 10 because
qtybalance----unbound textbox .. a calculated textbox getting its value thru dsum
But the code didnt work, the if statement always evaluated false.
use of Adezii's code shows the values in the 2 textboxes are of a different type.
At least it does in my version of access.
So my conclusion is that the contents of a textbox is not necessarily of type string.
Actually I remember this happening for me in the past in one of my own projects
Therefore my use of CStr()
2) Checkbox is a bound control and a calculated value. Isn't this bad database design. Calculated values on a form should not be saved in the table, but recomputed each time.
Yes it is. A general rule of good database design is "don't save calculated values".
Good or bad, I just answered the question.
To be honest I didn't even notice the statement that the checkbox was bound.