2009-10-12 4 views
0

나는 다음과 같은 쿼리를 작성했습니다 :BeforeUpdate 문제 런타임 오류 2115

Private Sub Size_Sqft_BeforeUpdate(Cancel As Integer) 
    Me!Size_Sqft = Nz(Me!Size_Sqft, 0) 
End Sub 

하지만 널 만들기 위해 필드에 제로를 제거하는 동안, 나는 다음과 같은 오류가 점점 오전 :

Runtime error 2115

Macro and function set to before update and validation rule property for this field is preventing manual data entry screen for company from saving the data in the field.

답변

2

을 해당 필드의 AfterUpdate 이벤트에 해당 코드를 넣어야합니다.

1

저는 이것이 오래된 스레드이며 이미 답변을 받았지만 데이터베이스에 다시 쓰지 않아도되는 또 다른 솔루션이 있습니다. 다른 사람이이 질문을 우연히 만났을 때를 대비해서 추가 할 것입니다.

Private Sub ControlName_BeforeUpdate(Cancel as integer) 
    If isValid(Me.ControlName.Value) = False Then 
     Cancel = True 
     Me.ControlName.Undo 
    End If 
End Sub 

Private Function isValid(ByVal...) as boolean 
    ' validate control value here 
End Function