求助!!关于两条代码
Private Sub comprint_Click() '打印住宿登记单据
Printer.Height = 8000: Printer.Width = 8000
Printer.CurrentX = 1100: Printer.CurrentY = 300
Printer.FontSize = 12
Printer.Print " 住宿证 "
Dim A, B, c, D As Integer
A = 100: B = 500: c = 4800: D = 400
Printer.FontSize = 10
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print Date & " " & Time & " NO." & bh.Text
B = B + D
Printer.Line (A, B + 100)-(c, B + 100)
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print "姓名:" & ZSDJ(0).Text
B = B + D
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print "房间号:" & DBCombo1.Text
B = B + D
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print "押金:" & Format(ZSDJ(10).Text, "0.00")
B = B + D
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print Combo2.Text & ":" & ZSDJ(8).Text & "%"
B = B + D
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print "补交日期: " & DTP2.Value
B = B + D
Printer.Line (A, B + 100)-(c, B + 100)
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print "操作员: " & czy.Text & " 欢迎光临"
Printer.EndDoc
End Sub
运行后出现‘482’打印机错误,请问语句哪里有错?
有一command控件组,其caption与房间号相同,当按钮为绿色表示无人,蓝色为有人,代码如下:
Private Sub Form_Activate()
Dim i As Integer '定义一个整型变量
Dim criteria As String '定义一个字符串变量
Dim mydb1 As Database '定义数据库
Dim myrs1 As Recordset '定义字段
Dim myrs2 As Recordset
Dim myrs3 As Recordset
Set mydb1 = Workspaces(0).OpenDatabase(App.Path & "\kfgl.mdb") '定义数据环境
Set myrs1 = mydb1.OpenRecordset("kf", dbOpenSnapshot) '定义数据表
'入住房间查询
sql = "select * from kf where kf.房态 like " + Chr(34) + "入住" + Chr(34) + ""
Set myrs2 = mydb1.OpenRecordset(sql)
'维修房间查询
sql = "select * from kf where kf.房态 like " + Chr(34) + "维修" + Chr(34) + ""
Set myrs3 = mydb1.OpenRecordset(sql)
For i = 0 To 139 '房态显示
criteria = "房间号 ='" & Command1(i).Caption & "'"
myrs1.FindFirst criteria
If myrs1.NoMatch Then
Else
If myrs1.Fields("房态") = "空房" Then Command1(i).BackColor = RGB(0, 255, 0) '空房
If myrs1.Fields("房态") = "入住" Then Command1(i).BackColor = RGB(0, 0, 255) '入住
If myrs1.Fields("房态") = "维修" Then Command1(i).BackColor = RGB(255, 255, 0) '维修
End If
Next i
表kf的字段“标志”也可判断房间是否有人住,0为无人,1为有人。
现在想实现在command的单击事件时,按绿色按钮调用窗体1,蓝色调用窗体2,代码该如何写?