Charity
03-16-2006, 07:59 AM
Hi,
I am getting a weird error that I have no idea how to fix. After the user enters the number of days a house has been worked on, I want to determine if the # of days in a house exceeds the number of days allowed for that house. I am able to get the calculation to work, but I get the following error:
Runtime error 2115:
The macro or function set to the BeforeUpdate or ValidationRule property for this field is preventing Microsoft Office Access from saving data in the field.
However, there is not anything in the BeforeUpdate or ValidationRule properties for the field. Just to be sure I even created a brand new field and I got the same answer. What I discovered is that access is automatically creating a BeforeUpdate event for the field. Does anyone know what might be happening?
Here is my code:
Private Sub Number_of_Days_in_House_AfterUpdate()
'to determine if the number of days in a house exceeds the number of days allowed
'returns a yes if Days_In_House is greater than Days_Allowed
Dim Days_Allowed As Integer
Dim Days_In_House As Integer
Dim Result As String
Me.Number_of_Days_in_House.SetFocus
Days_In_House = CInt(Me.Number_of_Days_in_House.Text)
Form_FRM_DMUR.Number_of_Days_Allowed.SetFocus
Days_Allowed = CInt(Form_FRM_DMUR.Number_of_Days_Allowed.Text)
If Days_In_House <= Days_Allowed Then Result = "No" Else: Result = "Yes"
Me.Exceeds_Days.SetFocus
Me.Exceeds_Days.Text = Result
End Sub
The last line is where I get the error.
Any help would be great, I'm stumped!
-Charity :help
I am getting a weird error that I have no idea how to fix. After the user enters the number of days a house has been worked on, I want to determine if the # of days in a house exceeds the number of days allowed for that house. I am able to get the calculation to work, but I get the following error:
Runtime error 2115:
The macro or function set to the BeforeUpdate or ValidationRule property for this field is preventing Microsoft Office Access from saving data in the field.
However, there is not anything in the BeforeUpdate or ValidationRule properties for the field. Just to be sure I even created a brand new field and I got the same answer. What I discovered is that access is automatically creating a BeforeUpdate event for the field. Does anyone know what might be happening?
Here is my code:
Private Sub Number_of_Days_in_House_AfterUpdate()
'to determine if the number of days in a house exceeds the number of days allowed
'returns a yes if Days_In_House is greater than Days_Allowed
Dim Days_Allowed As Integer
Dim Days_In_House As Integer
Dim Result As String
Me.Number_of_Days_in_House.SetFocus
Days_In_House = CInt(Me.Number_of_Days_in_House.Text)
Form_FRM_DMUR.Number_of_Days_Allowed.SetFocus
Days_Allowed = CInt(Form_FRM_DMUR.Number_of_Days_Allowed.Text)
If Days_In_House <= Days_Allowed Then Result = "No" Else: Result = "Yes"
Me.Exceeds_Days.SetFocus
Me.Exceeds_Days.Text = Result
End Sub
The last line is where I get the error.
Any help would be great, I'm stumped!
-Charity :help