|
dim str as string
str="DyelotDate=#" & Me.DyelotDate.Value & "#"
str=str & " and MachineName='" & Me.MachineName.Value & "'"
str=str & " and PlanBath=" & Me.PlanBath.Value
if Dcount("*","Tbl_DyeHistory",str)>0 then
MsgBox "系统检测到当天" & Me.MachineName.Value & " 机台的这个" & Me.PlanBath.Value & " 已经存在," & "请核对后重新输入新的PlanBath ", vbInformation, "提示重复"
end if
或
dim ssql as string
Dim rs As New ADODB.Recordset
ssql="SELECT * FROM Tbl_DyeHistory WHERE "
ssql=ssql & "DyelotDate=#" & Me.DyelotDate.Value & "#"
ssql=ssql & " and MachineName='" & Me.MachineName.Value & "'"
ssql=ssql & " and PlanBath=" & Me.PlanBath.Value
rs.Open ssql,CurrentProject.Connection, adOpenStatic, adLockReadOnly
If rs.RecordCount > 0 Then
MsgBox "系统检测到当天" & Me.MachineName.Value & " 机台的这个" & Me.PlanBath.Value & " 已经存在," & "请核对后重新输入新的PlanBath ", vbInformation, "提示重复"
end if
rs.close
set rs=nothing |
|