|
问题:下列代码执行后我希望打印出报关单并将cmdprt按钮失效,但现在执行到cmdprt.Enabled = False
时报错“无法找到焦点”,请问,cmdprt.Enabled = False在此的正确写法,谢谢。
Private Sub cmdprt_Click()
Dim sql As String, sql2 As String
If MsgBox(" 您确认要打印报关单吗? ", vbQuestion + vbYesNo, gTitle) = vbYes Then
cmdprt.Enabled = False
DoCmd.OpenReport "rptData", acViewNormal '打印报关单
sql = "UPDATE tbldata " & "tbldata SET tbldata.完成 = True " & _
"WHERE (((tbldata.打印)=True))"
DoCmd.RunSQL sql '将打印的数据标记为已打印
sql2 = "UPDATE tbldata " & "tbldata SET tbldata.打印 = false "
DoCmd.RunSQL sql2 '清除待打印标记
Me.noprint.Requery '刷新未打印数据子窗体
Me.PrtReady.Requery '刷新待打印数据子窗体
DoCmd.Beep
End If
End Sub |
|