[attach]19102[/attach] 作者: zyz218 时间: 2006-7-18 21:57
谢谢你的例子,确实没错,但我要更新的是个查询名叫:IQC_Check CAR
sql = "UPDATE IQC_Check CAR SET IQC_Check CAR.[Check] = True WHERE ((IQC_Check CAR.Ratio)> " & Me.Text3 & ") AND ((IQC_Check CAR.CheckTotal)>" & Me.Text8 & ") AND ((IQC_Check CAR.YearZhou)='" & Me.Text7 & "'));" 作者: andymark 时间: 2006-7-18 22:03
IQC_Check CAR 查询名有空格用[]括起来试试 作者: zyz218 时间: 2006-7-18 22:13
Private Sub Text7_AfterUpdate()
Dim sql As String
Dim conn As New ADODB.Connection
Set conn = CurrentProject.Connection
'查询是否发行过
If Not IsNull(DLookup("Checked", "IQC_Check", "YearZhou='" & Me.Text7 & "' and Checked=true")) Then '采用andymark兄给予的方法,在此感谢!
MsgBox "已发行过,请不要重复发行。若需重复操作,可向管理员寻求技术支持!"
Exit Sub
End If
'提取要发行的记录
sql = "UPDATE [IQC_Check CAR] SET [IQC_Check CAR].[Check] = True WHERE (([IQC_Check CAR].Ratio)> " & Me.Text3 & ") AND (([IQC_Check CAR].CheckTotal)>" & Me.Text8 & ") AND (([IQC_Check CAR].YearZhou)='" & Me.Text7 & "'));"
conn.Execute sql
Set conn = Nothing
End Sub