Private Sub COLOR_BeforeUpdate(Cancel As Integer)
Dim STRSQL As String
Dim RS1 As Recordset
STRSQL = "SELECT * FROM SPEC list WHERE SPEC list.SPECNAME='" & Me.SPECNAME & "'AND SPEC list.COLOR='" & Me.COLOR & "'"
Set RS1 = CurrentDb.OpenRecordset(STRSQL)
If RS1.RecordCount <> 0 Then
MsgBox "你输入的资材已经有记录,请重新输入!"
Exit Sub
End If
Private Sub COLOR_BeforeUpdate(Cancel As Integer)
Dim STRSQL As String
STRSQL = "SPECNAME='" & Me.SPECNAME & "'AND COLOR='" & Me.COLOR & "'"
If not isnull(DLOOKUP("SPECNAME","[SPEC list]",STRSQL) THEN
MsgBox "你输入的资材已经有记录,请重新输入!"
cancel=true
Exit Sub
End If