Office中国论坛/Access中国论坛

标题: 在mdb下能正常运行,一旦mde了就报错,什么原因,请朋友们帮忙给看看! [打印本页]

作者: sxgaobo    时间: 2005-9-3 16:29
标题: 在mdb下能正常运行,一旦mde了就报错,什么原因,请朋友们帮忙给看看!
下面是代码,提示错:打印机设置有误,请核查!

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 台位
作者: sxgaobo    时间: 2005-9-5 22:09
在MDB状态可正常运行,如果转换成MDE后就出错,为什么啊?




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3