⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form4.frm

📁 天津大学电机试验台程序,可以测试电机启动电流
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form4 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "查询结果  天津大学自动化系研发   电机试验台一"
   ClientHeight    =   3630
   ClientLeft      =   4485
   ClientTop       =   2685
   ClientWidth     =   7110
   LinkTopic       =   "Form4"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3630
   ScaleWidth      =   7110
   ShowInTaskbar   =   0   'False
   Begin VB.Frame Frame4 
      Caption         =   "请选择操作内容"
      Height          =   1215
      Left            =   240
      TabIndex        =   12
      Top             =   2160
      Width           =   3495
      Begin VB.CommandButton Command4 
         Caption         =   "退   出"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   1080
         TabIndex        =   15
         Top             =   720
         Width           =   1335
      End
      Begin VB.CommandButton Command2 
         Caption         =   "查看结果"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2040
         TabIndex        =   14
         Top             =   240
         Width           =   1335
      End
      Begin VB.CommandButton Command1 
         Caption         =   "开始查询"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   240
         TabIndex        =   13
         Top             =   240
         Width           =   1335
      End
   End
   Begin VB.Frame Frame3 
      Caption         =   "查询结果"
      Height          =   1215
      Left            =   4200
      TabIndex        =   10
      Top             =   2160
      Width           =   2775
      Begin VB.ComboBox Combo1 
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   240
         TabIndex        =   11
         Top             =   360
         Width           =   2295
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "请输入查询条件"
      Height          =   1695
      Left            =   240
      TabIndex        =   2
      Top             =   240
      Width           =   3735
      Begin VB.TextBox Text2 
         Height          =   375
         Left            =   1680
         TabIndex        =   6
         Top             =   1080
         Width           =   1815
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   1680
         TabIndex        =   4
         Top             =   360
         Width           =   1815
      End
      Begin VB.Label Label2 
         Caption         =   "编    号:"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   495
         Left            =   240
         TabIndex        =   5
         Top             =   1080
         Width           =   1215
      End
      Begin VB.Label Label1 
         Caption         =   "起始日期:"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   255
         Left            =   240
         TabIndex        =   3
         Top             =   360
         Width           =   1215
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "请选择查询类型"
      Height          =   1695
      Left            =   4800
      TabIndex        =   0
      Top             =   240
      Width           =   2175
      Begin VB.OptionButton Option3 
         Caption         =   " 完全查询"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   375
         Left            =   240
         TabIndex        =   9
         Top             =   1200
         Width           =   1575
      End
      Begin VB.OptionButton Option2 
         Caption         =   "按编号查询"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   375
         Left            =   240
         TabIndex        =   8
         Top             =   720
         Width           =   1575
      End
      Begin VB.OptionButton Option1 
         Caption         =   "按日期查询"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   255
         Left            =   240
         TabIndex        =   7
         Top             =   360
         Width           =   1815
      End
   End
   Begin VB.Label Label7 
      AutoSize        =   -1  'True
      Caption         =   "请输入查询结果"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   7560
      TabIndex        =   1
      Top             =   600
      Width           =   1995
   End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim choose As Integer

Private Sub Combo1_Click()
Command2.Enabled = True
End Sub

Private Sub Command1_Click()

Combo1.Clear
Dim msg

Set reportdb = OpenDatabase("F:\天津大学电机试验台程序\试验台数据库\报表")
Set reportrd = reportdb.OpenRecordset("报表", dbOpenTable)
If (reportrd.EOF And reportrd.BOF) Then
msg = MsgBox("记录为空", vbOKOnly)
Exit Sub
Else
reportrd.MoveFirst
End If

If (choose = 0) Then
msg = MsgBox("请选择查询类型", vbOKOnly, "报警窗口")
Exit Sub
End If


If (choose = 1) Then

If (Trim(Text1.Text) = "") Then
msg = MsgBox("日期不能为空", vbOKOnly, "报警窗口")
Exit Sub
End If

Do Until reportrd.EOF
If (Val(Mid(reportrd.Fields("表名"), 1, 2) + Mid(reportrd.Fields("表名"), 4, 2) + Mid(reportrd.Fields("表名"), 7, 2)) >= Val(Mid(Trim(Text1.Text), 1, 2) + Mid(Trim(Text1.Text), 4, 2) + Mid(Trim(Text1.Text), 7, 2))) Then
Combo1.AddItem reportrd.Fields("表名")
End If
reportrd.MoveNext
Loop
Frame3.Enabled = True
If (Combo1.ListCount = 0) Then
msg = MsgBox("找不到符合要求的记录", vbOKOnly)
Else
Combo1.ListIndex = 0
End If
End If

If (choose = 2) Then

If (Trim(Text2.Text) = "") Then
msg = MsgBox("编号不能为空", vbOKOnly, "报警窗口")
Exit Sub
End If

Do Until reportrd.EOF
If (Mid(reportrd.Fields("表名"), 16, Len(reportrd.Fields("表名")) - 15) = Trim(Text2.Text)) Then
Combo1.AddItem reportrd.Fields("表名")
End If
reportrd.MoveNext
Loop
Frame3.Enabled = True
If (Combo1.ListCount = 0) Then
msg = MsgBox("找不到符合要求的记录", vbOKOnly)
Else
Combo1.ListIndex = 0
End If
End If

If (choose = 3) Then

If (Trim(Text1.Text) = "" Or Trim(Text2.Text) = "") Then
msg = MsgBox("日期或编号不能同时为空", vbOKOnly, "报警窗口")
Exit Sub
End If

Do Until reportrd.EOF
If (Mid(reportrd.Fields("表名"), 16, Len(reportrd.Fields("表名")) - 15) = Trim(Text2.Text) And Val(Mid(reportrd.Fields("表名"), 1, 2) + Mid(reportrd.Fields("表名"), 4, 2) + Mid(reportrd.Fields("表名"), 7, 2)) >= Val(Mid(Trim(Text1.Text), 1, 2) + Mid(Trim(Text1.Text), 4, 2) + Mid(Trim(Text1.Text), 7, 2))) Then
Combo1.AddItem reportrd.Fields("表名")
End If
reportrd.MoveNext
Loop
Frame3.Enabled = True
If (Combo1.ListCount = 0) Then
msg = MsgBox("找不到符合要求的记录", vbOKOnly)
Else
Combo1.ListIndex = 0
End If
End If



End Sub

Private Sub Command2_Click()
reportname = Combo1.Text
Form4.Hide
Form3.Show
End Sub


Private Sub Command4_Click()
End

End Sub

Private Sub Form_Load()

Command2.Enabled = False

End Sub

Private Sub Option1_Click()
'Dim n As Integer
'If (Trim(Text1.Text) <> "") Then
'Command1.Enabled = True
choose = 1
'Else
'n = MsgBox("日期不能为空", vbOKOnly, "报警窗口")
'End If
End Sub

Private Sub Option2_Click()
'Dim n As Integer
'If (Trim(Text2.Text) <> "") Then
'Command1.Enabled = True
choose = 2
'Else
'n = MsgBox("编号不能为空", vbOKOnly, "报警窗口")
'End If
End Sub

Private Sub Option3_Click()
'Dim n As Integer
'If (Trim(Text1.Text) <> "" And Trim(Text2.Text) <> "") Then
'Command1.Enabled = True
choose = 3
'Else
'n = MsgBox("日期或编号不能同时为空", vbOKOnly, "报警窗口")
'End If
End Sub

⌨️ 快捷键说明

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