frm仪表2.frm

来自「这是一个基于VB开发的程序,实现的是对仪器的查找和定期检修,并对检修的设备进行相」· FRM 代码 · 共 574 行 · 第 1/2 页

FRM
574
字号
      Index           =   9
      Left            =   120
      TabIndex        =   9
      Top             =   3000
      Width           =   1815
   End
   Begin VB.Label lblLabels 
      BackStyle       =   0  'Transparent
      Caption         =   "下次检定日期:"
      Height          =   255
      Index           =   8
      Left            =   120
      TabIndex        =   8
      Top             =   2760
      Width           =   1815
   End
   Begin VB.Label lblLabels 
      BackStyle       =   0  'Transparent
      Caption         =   "上次检定日期:"
      Height          =   255
      Index           =   7
      Left            =   120
      TabIndex        =   7
      Top             =   2400
      Width           =   1815
   End
   Begin VB.Label lblLabels 
      BackStyle       =   0  'Transparent
      Caption         =   "所属设备:"
      Height          =   255
      Index           =   6
      Left            =   120
      TabIndex        =   6
      Top             =   2040
      Width           =   1815
   End
   Begin VB.Label lblLabels 
      BackStyle       =   0  'Transparent
      Caption         =   "检定周期:"
      Height          =   255
      Index           =   5
      Left            =   120
      TabIndex        =   5
      Top             =   1680
      Width           =   1815
   End
   Begin VB.Label lblLabels 
      BackStyle       =   0  'Transparent
      Caption         =   "量程:"
      Height          =   255
      Index           =   4
      Left            =   120
      TabIndex        =   4
      Top             =   1440
      Width           =   1815
   End
   Begin VB.Label lblLabels 
      BackStyle       =   0  'Transparent
      Caption         =   "分类:"
      Height          =   255
      Index           =   3
      Left            =   120
      TabIndex        =   3
      Top             =   1080
      Width           =   1815
   End
   Begin VB.Label lblLabels 
      BackStyle       =   0  'Transparent
      Caption         =   "仪表名称:"
      Height          =   255
      Index           =   2
      Left            =   120
      TabIndex        =   2
      Top             =   840
      Width           =   1815
   End
   Begin VB.Label lblLabels 
      BackStyle       =   0  'Transparent
      Caption         =   "仪表编号:"
      Height          =   255
      Index           =   1
      Left            =   120
      TabIndex        =   1
      Top             =   480
      Width           =   1815
   End
   Begin VB.Label lblLabels 
      BackStyle       =   0  'Transparent
      Caption         =   "序号:"
      Height          =   255
      Index           =   0
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   1815
   End
   Begin VB.Image Image1 
      Height          =   8565
      Left            =   -3480
      Picture         =   "frm仪表2.frx":2C97A
      Top             =   -1800
      Width           =   15360
   End
End
Attribute VB_Name = "frm仪表1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim tt As Integer
Private Sub Combo1_Click()
Text2.Text = ""
End Sub
Private Sub Command1_Click()

If Text2.Text = "" Then
MsgBox "关键字不能为空!", vbCritical, "失败"
Else
frm仪表1.Hide
Form2.Show
End If
End Sub

Private Sub Command2_Click()
If Text2.Text = "" Then
MsgBox "关键字不能为空!", vbCritical, "失败"
Else
If Combo1.Text = "仪表编号" Then
datPrimaryRS.RecordSource = "select * from 仪表 where 仪表编号='" + Text2.Text + "' "


  datPrimaryRS.Refresh

  Else
If Combo1.Text = "仪表名称" Then
datPrimaryRS.RecordSource = "select * from 仪表 where 仪表名称='" + Text2.Text + "' "

  datPrimaryRS.Refresh

  Else
If Combo1.Text = "分类" Then
datPrimaryRS.RecordSource = "select * from 仪表 where 分类='" + Text2.Text + "' "


  datPrimaryRS.Refresh

  Else
If Combo1.Text = "量程" Then
datPrimaryRS.RecordSource = "select * from 仪表 where 量程='" + Text2.Text + "' "


  datPrimaryRS.Refresh

  Else
If Combo1.Text = "检定周期" Then
datPrimaryRS.RecordSource = "select * from 仪表 where 检定周期='" + Text2.Text + "' "


  datPrimaryRS.Refresh

  Else
If Combo1.Text = "所属设备" Then
datPrimaryRS.RecordSource = "select * from 仪表 where 所属设备='" + Text2.Text + "' "


  datPrimaryRS.Refresh


  Else
If Combo1.Text = "备注" Then
datPrimaryRS.RecordSource = "select * from 仪表 where 备注='" + Text2.Text + "' "
  datPrimaryRS.Refresh

End If
End If
End If
End If
End If
End If
End If
End If
End Sub

Private Sub Form_Load()
  main.Enabled = False
  Combo1.AddItem ("仪表编号")
  Combo1.AddItem ("仪表名称")
  Combo1.AddItem ("分类")
  Combo1.AddItem ("量程")
  Combo1.AddItem ("检定周期")
  Combo1.AddItem ("所属设备")
  Combo1.AddItem ("备注")
End Sub

Private Sub Form_Unload(cancel As Integer)
  Screen.MousePointer = vbDefault
  main.Enabled = True
End Sub

Private Sub datPrimaryRS_Error(ByVal ErrorNumber As Long, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, fCancelDisplay As Boolean)
  '错误处理程序代码置于此处
  '想要忽略错误,注释掉下一行
  '想要捕获它们,在此添加代码以处理它们
  MsgBox "Data error event hit err:" & Description
End Sub

Private Sub datPrimaryRS_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
  '为这个 recordset 显示当前记录位置
  datPrimaryRS.Caption = "Record: " & CStr(datPrimaryRS.Recordset.AbsolutePosition)
End Sub

Private Sub datPrimaryRS_WillChangeRecord(ByVal adReason As ADODB.EventReasonEnum, ByVal cRecords As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
  '验证代码置于此处
  '下列动作发生时该事件被调用
  Dim bCancel As Boolean

  Select Case adReason
  Case adRsnAddNew
  Case adRsnClose
  Case adRsnDelete
  Case adRsnFirstChange
  Case adRsnMove
  Case adRsnRequery
  Case adRsnResynch
  Case adRsnUndoAddNew
  Case adRsnUndoDelete
  Case adRsnUndoUpdate
  Case adRsnUpdate
  End Select

  If bCancel Then adStatus = adStatusCancel
End Sub

Private Sub cmdAdd_Click()
  On Error GoTo AddErr
  datPrimaryRS.Recordset.AddNew

  Exit Sub
AddErr:
  MsgBox err.Description
End Sub

Private Sub cmdDelete_Click()
  On Error GoTo DeleteErr
  
  msg = MsgBox("您确定要退出本系统吗?", 36, "退出系统")
 If msg = 6 Then
   With datPrimaryRS.Recordset
    .Delete
    .MoveNext
   If .EOF Then .MoveLast
  End With
  Exit Sub
    
DeleteErr:
  MsgBox err.Description
End If
  

End Sub

Private Sub cmdRefresh_Click()
'add
datPrimaryRS.RecordSource = "select * from 仪表 "
  '只有多用户应用程序需要
  On Error GoTo RefreshErr
  datPrimaryRS.Refresh
  Exit Sub
RefreshErr:
  MsgBox err.Description
End Sub

Private Sub cmdUpdate_Click()
  On Error GoTo UpdateErr

  datPrimaryRS.Recordset.UpdateBatch adAffectAll
  Exit Sub
UpdateErr:
  MsgBox err.Description
End Sub

Private Sub cmdClose_Click()
main.Enabled = True
  Unload Me
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?