📄 frm_计量器具维修.frm
字号:
Grid1.Visible = False
Grid.Visible = False
Add = 1
CmdZj.Enabled = False
cmdxg.Enabled = False
CmdCz.Enabled = False
cmdll.Enabled = False
cmdsc.Enabled = False
End Sub
Private Sub Form_Load()
Grid.Visible = False
Me.Left = 30
Me.Top = 200
Add = 0
badd = False
' Cxx.Visible = False
' Tsbs.Visible = False
Dim rst As New ADODB.Recordset
If rst.State = 1 Then rst.Close
rst.CursorLocation = adUseClient
rst.Open "select * from dwxx", Conn
If rst.EOF = False Then
badd = True
DTPqyrq.Value = Date
DTPbfrq.Value = Date
Dwmc = Trim(rst!Dwmc)
' Jddw = Trim(rst!jydw)
' Tjddw = Jddw
Cdj.Clear
Cdj.AddItem "强制检定"
Cdj.AddItem "一般管理"
Cdj.AddItem "特种设备"
CZt.Clear
CZt.AddItem "启用"
CZt.AddItem "禁用"
Czqdw.Clear
Czqdw.AddItem "月"
Czqdw.AddItem "年"
Czqdw.AddItem "天"
Dim rstt As New ADODB.Recordset
If rstt.State = 1 Then rstt.Close
rstt.CursorLocation = adUseClient
rstt.Open "select qjlb from qjzl group by qjlb", Conn
Clb.Clear
Do While rstt.EOF = False
Clb.AddItem Trim(rstt!qjlb)
rstt.MoveNext
Loop
Czb.Clear
If rstt.State = 1 Then rstt.Close
rstt.CursorLocation = adUseClient
rstt.Open "select bmmc from bmxx group by bmmc", Conn
Csybm.Clear
Do While rstt.EOF = False
Csybm.AddItem Trim(rstt!bmmc)
rstt.MoveNext
Loop
Sd
Else
MsgBox "系统尚未设置单位信息,请设置单位信息后在执行此操作!", vbCritical, "器具管理"
Exit Sub
End If
End Sub
Private Sub Grid_DblClick()
On Error GoTo ERR
If rsa.State = 1 Then
If rsa.RecordCount > 0 Then
If Trim(rsa!设备编号) <> "" Then
Tbh = Trim(rsa!设备编号)
Dim rst As New ADODB.Recordset
If rst.State = 1 Then rst.Close
rst.CursorLocation = adUseClient
rst.Open "select * from jlqjxx where bh='" & Tbh & "'", Conn
If rst.EOF = False Then
RsToText rst
DTPwxrq.Value = rsa!维修日期
Twxdw = IIf(IsNull(rsa!维修单位), "", rsa!维修单位)
Twxr = IIf(IsNull(rsa!维修人), "", rsa!维修人)
Twxyy = IIf(IsNull(rsa!维修原因), "", rsa!维修原因)
Twxjg = IIf(IsNull(rsa!维修结果), "", rsa!维修结果)
Bh = rst!Bh
WXdw = IIf(IsNull(rsa!维修单位), "", rsa!维修单位)
WXsj = rsa!维修日期
Jl = True
Grid.Visible = False
Else
Jl = False
End If
Grid.Visible = False
End If
End If
End If
Exit Sub
ERR:
Exit Sub
End Sub
Private Sub Grid_HeadClick(ByVal ColIndex As Integer)
Dim str As String
Dim st As String
str = Grid.Columns.Item(ColIndex).Caption
st = ""
Select Case str
Case "设备编号"
st = "bh"
Case "设备名称"
st = "mc"
Case "维修日期"
st = "wxrq"
Case "维修单位"
st = "wxdw"
Case "维修人"
st = "wxr"
End Select
If st = "" Then Exit Sub
If rsa.State = 1 Then rsa.Close
rsa.CursorLocation = adUseClient
rsa.Open "select bh as 设备编号 , mc as 设备名称 ,wxrq as 维修日期,wxdw as 维修单位,wxr as 维修人, wxyy as 维修原因, wxjg as 维修结果 from jlqjwx where bh='" & Tbh & "' order by " & st, Conn, adOpenStatic, adLockReadOnly
Set Grid.DataSource = rsa
End Sub
Private Sub Grid_KeyDown(KeyCode As Integer, Shift As Integer)
On Error GoTo ERR
If KeyCode <> 13 Then Exit Sub
If rsa.State = 1 Then
If rsa.RecordCount > 0 Then
If Trim(rsa!设备编号) <> "" Then
Tbh = Trim(rsa!设备编号)
Dim rst As New ADODB.Recordset
If rst.State = 1 Then rst.Close
rst.CursorLocation = adUseClient
rst.Open "select * from jlqjxx where bh='" & Tbh & "'", Conn
If rst.EOF = False Then
RsToText rst
DTPwxrq.Value = rsa!维修日期
Twxdw = IIf(IsNull(rsa!维修单位), "", rsa!维修单位)
Twxr = IIf(IsNull(rsa!维修人), "", rsa!维修人)
Twxyy = IIf(IsNull(rsa!维修原因), "", rsa!维修原因)
Twxjg = IIf(IsNull(rsa!维修结果), "", rsa!维修结果)
Bh = rst!Bh
WXdw = IIf(IsNull(rsa!维修单位), "", rsa!维修单位)
WXsj = rsa!维修日期
Jl = True
Grid.Visible = False
Else
Jl = False
End If
Grid.Visible = False
End If
End If
End If
Exit Sub
ERR:
Exit Sub
End Sub
Private Sub Grid1_DblClick()
On Error GoTo ERR
If rs.State = 1 Then
If rs.RecordCount > 0 Then
If Trim(rs!设备编号) <> "" Then
Tbh = Trim(rs!设备编号)
Dim rst As New ADODB.Recordset
If rst.State = 1 Then rst.Close
rst.CursorLocation = adUseClient
rst.Open "select * from jlqjxx where bh='" & Tbh & "'", Conn
If rst.EOF = False Then
RsToText rst
DTPwxrq.Value = rs!维修日期
Twxdw = IIf(IsNull(rs!维修单位), "", rs!维修单位)
Twxr = IIf(IsNull(rs!维修人), "", rs!维修人)
Twxyy = IIf(IsNull(rs!维修原因), "", rs!维修原因)
Twxjg = IIf(IsNull(rs!维修结果), "", rs!维修结果)
Bh = rst!Bh
Jl = True
WXdw = IIf(IsNull(rs!维修单位), "", rs!维修单位)
WXsj = rs!维修日期
Grid1.Visible = False
Else
Jl = False
End If
Grid1.Visible = False
End If
End If
End If
Exit Sub
ERR:
Exit Sub
End Sub
Private Sub Grid1_HeadClick(ByVal ColIndex As Integer)
Dim str As String
Dim st As String
str = Grid1.Columns.Item(ColIndex).Caption
st = ""
Select Case str
Case "设备编号"
st = "bh"
Case "设备名称"
st = "mc"
Case "维修日期"
st = "wxrq"
Case "维修单位"
st = "wxdw"
Case "维修人"
st = "wxr"
Case "维修原因"
st = "wxyy"
Case "维修结果"
st = "wxjg"
End Select
If st = "" Then Exit Sub
If rs.State = 1 Then rs.Close
rs.CursorLocation = adUseClient
rs.Open "select bh as 设备编号 , mc as 设备名称 ,wxrq as 维修日期,wxdw as 维修单位,wxr as 维修人, wxyy as 维修原因, wxjg as 维修结果 from jlqjwx order by " & st, Conn, adOpenStatic, adLockReadOnly
Set Grid1.DataSource = rs
End Sub
Private Sub Grid1_KeyDown(KeyCode As Integer, Shift As Integer)
On Error GoTo ERR
If KeyCode <> 13 Then Exit Sub
If rs.State = 1 Then
If rs.RecordCount > 0 Then
If Trim(rs!设备编号) <> "" Then
Tbh = Trim(rs!设备编号)
Dim rst As New ADODB.Recordset
If rst.State = 1 Then rst.Close
rst.CursorLocation = adUseClient
rst.Open "select * from jlqjxx where bh='" & Tbh & "'", Conn
If rst.EOF = False Then
RsToText rst
DTPwxrq.Value = rs!维修日期
Twxdw = IIf(IsNull(rs!维修单位), "", rs!维修单位)
Twxr = IIf(IsNull(rs!维修人), "", rs!维修人)
Twxyy = IIf(IsNull(rs!维修原因), "", rs!维修原因)
Twxjg = IIf(IsNull(rs!维修结果), "", rs!维修结果)
Bh = rst!Bh
Jl = True
WXdw = IIf(IsNull(rs!维修单位), "", rs!维修单位)
WXsj = rs!维修日期
Grid1.Visible = False
Else
Jl = False
End If
Grid1.Visible = False
Jl = False
End If
End If
End If
Exit Sub
ERR:
Exit Sub
End Sub
Private Sub Image1_Click()
If Add <> 0 Then Exit Sub
Frm_选择记录.Show 1
If Frm_选择记录.sele = "" Then
Exit Sub
End If
Qk1
Grid1.Visible = False
Grid.Visible = False
Dim rst As New ADODB.Recordset
If rst.State = 1 Then rst.Close
rst.CursorLocation = adUseClient
rst.Open "select * from jlqjxx where bh='" & Format(Frm_选择记录.sele, "00000") & "'", Conn
If rst.EOF = False Then
RsToText rst
Jl = True
If rsa.State = 1 Then rsa.Close
rsa.CursorLocation = adUseClient
rsa.Open "select bh as 设备编号 , mc as 设备名称 ,wxrq as 维修日期,wxdw as 维修单位,wxr as 维修人, wxyy as 维修原因, wxjg as 维修结果 from jlqjwx where bh='" & Format(Tbh, "00000") & "'", Conn, adOpenStatic, adLockReadOnly
If rsa.EOF = False Then
Grid.Visible = True
Set Grid.DataSource = rsa
Bh = rst!Bh
Tbh = rst!Bh
Else
Jl = False
Bh = rst!Bh
Tbh = rst!Bh
End If
Else
Jl = False
End If
End Sub
Private Sub Tbh_KeyPress(KeyAscii As Integer)
If Add <> 0 Then Exit Sub
If KeyAscii = 13 Then
Qk1
Grid1.Visible = False
Grid.Visible = False
Tbh = Format(Tbh, "00000")
Dim rst As New ADODB.Recordset
If rst.State = 1 Then rst.Close
rst.CursorLocation = adUseClient
rst.Open "select * from jlqjxx where bh='" & Tbh & "'", Conn
If rst.EOF = False Then
RsToText rst
Jl = True
If rsa.State = 1 Then rsa.Close
rsa.CursorLocation = adUseClient
rsa.Open "select bh as 设备编号 , mc as 设备名称 ,wxrq as 维修日期,wxdw as 维修单位,wxr as 维修人, wxyy as 维修原因, wxjg as 维修结果 from jlqjwx where bh='" & Format(Tbh, "00000") & "'", Conn, adOpenStatic, adLockReadOnly
If rsa.EOF = False Then
Grid1.Visible = False
Grid.Visible = True
Set Grid.DataSource = rsa
Bh = rst!Bh
Else
Jl = False
Bh = rst!Bh
End If
Else
Jl = False
End If
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If Add <> 0 Then Exit Sub
If KeyAscii = 13 Then
Grid1.Visible = False
Grid.Visible = False
Qk1
Dim rst As New ADODB.Recordset
If rst.State = 1 Then rst.Close
rst.CursorLocation = adUseClient
rst.Open "select * from jlqjxx where bh='" & Format(Text3, "00000") & "'", Conn
If rst.EOF = False Then
RsToText rst
Jl = True
If rsa.State = 1 Then rsa.Close
rsa.CursorLocation = adUseClient
rsa.Open "select bh as 设备编号 , mc as 设备名称 ,wxrq as 维修日期,wxdw as 维修单位,wxr as 维修人, wxyy as 维修原因, wxjg as 维修结果 from jlqjwx where bh='" & Format(Text3, "00000") & "'", Conn, adOpenStatic, adLockReadOnly
If rsa.EOF = False Then
Grid1.Visible = False
Grid.Visible = True
Set Grid.DataSource = rsa
Bh = rst!Bh
Tbh = rst!Bh
Else
Jl = False
Bh = rst!Bh
Tbh = rst!Bh
End If
End If
Else
Jl = False
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -