Value entered isnt valid Error

Rats

Registered User.
Local time
Tomorrow, 02:11
Joined
Jan 11, 2005
Messages
151
I have made an Income calculator for a financial planning database. The calculator is a subform on a tabbed control.
To calculate tax I have created a tax table form [Tax Table Calc Frm] and placed it as a sub form in the Income form.
So that I can get the tax to calculate during input of income details I have set the following code on the "onexit event" of each of the income fields so that the calculated value appears in the [C1taxMedi] or [C2TaxMedi] fields .
There are five income fields for the main client(C1) and the same for their partner (C2)(Husband & wife etc).
Initially, the process functioned as required, so I set the visible property of the tax calculator fields to No, closed it down etc.
But now when I open up the form and try to go into any client I get a "RunTime Error -2147352567(80020009)- The value entered isn't valid for this field".

I checked the values of the various fields and the formats are the same. The line of code that is highlighted in break mode is highlighted below. If I comment out this line I get no errors but it obviously doesn't function either.

Can anyone please tell me what I have done wrong with the code???

Code:
Private Sub C1Gross_Exit(Cancel As Integer)

DoCmd.Echo False
[Tax Table Calc Frm].Form.Requery
[COLOR=SandyBrown]Me.C1TaxMedi = Form![Tax Table Calc Frm].Form![Text58][/COLOR]
DoCmd.Echo True
End Sub
 
Try:
Me.C1TaxMedi = Me![Tax Table Calc Frm].Form.Text58
And I believe controls need to be visible to have their .Value referenced.
 
Try using the table that the form is bound to, and change the data using the table instead when you close the form. perhaps using ADO?
 
Since these are calculated values you shouldn't be storing them at all. Use a query instead
 

Users who are viewing this thread

Back
Top Bottom