|
下面是代码,提示错:打印机设置有误,请核查!
Private Sub 厨房传菜_Click()
On Error GoTo Err_厨房传菜_Click
If DCount("[名称]", "[已点菜表]", "[台位编号]=form.[台位编号] and [传菜]=0 And not IsNull([出菜窗口])") > 0 Then
Dim myrpt As Report
If DCount("[名称]", "[已点菜表]", "[台位编号]=form.[台位编号] and [传菜]=0 And [出菜窗口]='一号窗口'") > 0 Then
CurrentDb().QueryDefs("zwtb").SQL = "SELECT 已点菜表.台位编号, 台位号.台位名, 已点菜表.名称, 已点菜表.数量, 已点菜表.出菜窗口, 已点菜表.备注, 已点菜表.传菜, 已点菜表.厨师姓名 FROM 已点菜表 INNER JOIN 台位号 ON 已点菜表.台位编号 = 台位号.台位号 WHERE (((已点菜表.台位编号)=[Forms]![就餐表]![台位编号]) AND ((已点菜表.出菜窗口)='一号窗口') AND ((已点菜表.传菜)=0))"
If DMax("[打印方式]", "[打印机表]", "[所在窗口]='一号窗口'") = "单列打印" Then
DoCmd.OpenReport "厨房传菜单1", acViewDesign
Set myrpt = Reports("厨房传菜单1")
Set myrpt.Printer = Printers(DMax("[打印机名称]", "[打印机表]", "[所在窗口]='一号窗口'"))
For i = 1 To 3
DoCmd.OpenReport "厨房传菜单1", acViewNormal, "", "", acNormal
Next i
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE 已点菜表 SET 已点菜表.传菜 = 1 WHERE (((已点菜表.台位编号)=[Forms]![就餐表]![台位编号]) AND ((已点菜表.出菜窗口)='一号窗口'))"
DoCmd.SetWarnings True
DoCmd.Close acReport, "厨房传菜单1"
Me.已点菜表子窗体.Requery
Else
DoCmd.OpenReport "厨房传菜单", acViewDesign
Set myrpt = Reports("厨房传菜单")
Set myrpt.Printer = Printers(DMax("[打印机名称]", "[打印机表]", "[所在窗口]='一号窗口'"))
For i = 1 To 3
DoCmd.OpenReport "厨房传菜单", acViewNormal, "", "", acNormal
Next i
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE 已点菜表 SET 已点菜表.传菜 = 1 WHERE (((已点菜表.台位编号)=[Forms]![就餐表]![台位编号]) AND ((已点菜表.出菜窗口)='一号窗口'))"
DoCmd.SetWarnings True
DoCmd.Close acReport, "厨房传菜单"
Me.已点菜表子窗体.Requery
End If
End If
If DCount("[名称]", "[已点菜表]", "[台位编号]=form.[台位编号] and [传菜]=0 And [出菜窗口]='二号窗口'") > 0 Then
CurrentDb().QueryDefs("zwtb").SQL = "SELECT 已点菜表.台位编号, 台位号.台位名, 已点菜表.名称, 已点菜表.数量, 已点菜表.出菜窗口, 已点菜表.备注, 已点菜表.传菜, 已点菜表.厨师姓名 FROM 已点菜表 INNER JOIN 台位号 ON 已点菜表.台位编号 = 台位号.台位号 WHERE (((已点菜表.台位编号)=[Forms]![就餐表]![台位编号]) AND ((已点菜表.出菜窗口)='二号窗口') AND ((已点菜表.传菜)=0))"
If DMax("[打印方式]", "[打印机表]", "[所在窗口]='二号窗口'") = "单列打印" Then
DoCmd.OpenReport "厨房传菜单1", acViewDesign
Set myrpt = Reports("厨房传菜单1")
Set myrpt.Printer = Printers(DMax("[打印机名称]", "[打印机表]", "[所在窗口]='二号窗口'"))
For i = 1 To 3
DoCmd.OpenReport "厨房传菜单1", acViewNormal, "", "", acNormal
Next i
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE 已点菜表 SET 已点菜表.传菜 = 1 WHERE (((已点菜表.台位编号)=[Forms]![就餐表]![台位编号]) AND ((已点菜表.出菜窗口)='二号窗口'))"
DoCmd.SetWarnings True
DoCmd.Close acReport, "厨房传菜单1"
Me.已点菜表子窗体.Requery
Else
DoCmd.OpenReport "厨房传菜单", acViewDesign
Set myrpt = Reports("厨房传菜单")
Set myrpt.Printer = Printers(DMax("[打印机名称]", "[打印机表]", "[所在窗口]='二号窗口'"))
For i = 1 To 3
DoCmd.OpenReport "厨房传菜单", acViewNormal, "", "", acNormal
Next i
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE 已点菜表 SET 已点菜表.传菜 = 1 WHERE (((已点菜表.台位编号)=[Forms]![就餐表]![台位编号]) AND ((已点菜表.出菜窗口)='二号窗口'))"
DoCmd.SetWarnings True
DoCmd.Close acReport, "厨房传菜单"
Me.已点菜表子窗体.Requery
End If
End If
If DCount("[名称]", "[已点菜表]", "[台位编号]=form.[台位编号] and [传菜]=0 And [出菜窗口]='三号窗口'") > 0 Then
CurrentDb().QueryDefs("zwtb").SQL = "SELECT 已点菜表.台位编号, 台位号.台位名, 已点菜表.名称, 已点菜表.数量, 已点菜表.出菜窗口, 已点菜表.备注, 已点菜表.传菜, 已点菜表.厨师姓名 FROM 已点菜表 INNER JOIN 台位 |
|