glreport.frm

来自「VB与欧姆龙PLC通过RS-232串口通讯 的上位机程序」· FRM 代码 · 共 139 行

FRM
139
字号
VERSION 5.00
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Begin VB.Form Glreport 
   BackColor       =   &H00F4FFF5&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "本次干料报表"
   ClientHeight    =   8595
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   12750
   Icon            =   "Glreport.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   8595
   ScaleWidth      =   12750
   StartUpPosition =   2  '屏幕中心
   Begin MSDBGrid.DBGrid glrptgrid 
      Bindings        =   "Glreport.frx":0442
      Height          =   7815
      Left            =   -120
      OleObjectBlob   =   "Glreport.frx":0457
      TabIndex        =   2
      Top             =   120
      Width           =   12855
   End
   Begin VB.CommandButton CmdGlback 
      BackColor       =   &H00C0E0FF&
      Caption         =   "返    回(&R)"
      Height          =   495
      Left            =   9960
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   8040
      Width           =   1575
   End
   Begin VB.CommandButton CmdGllj 
      BackColor       =   &H00C0E0FF&
      Caption         =   "查询报表(&Q)"
      Height          =   495
      Left            =   8040
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   8040
      Width           =   1575
   End
   Begin VB.Data Gldata 
      Appearance      =   0  'Flat
      BackColor       =   &H00F4FFF5&
      Caption         =   "             *   本   次   干   料   监   控   报   表   *"
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   495
      Left            =   0
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   8040
      Width           =   7695
   End
End
Attribute VB_Name = "Glreport"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdGlback_Click()
djgc.lbldqzt.Caption = "等待命令"
Unload Me
djgc.cmdgb.Enabled = True
End Sub
Private Sub CmdGllj_Click()
tbl = 0
glstr1 = InputBox("请输入起始时间(yyyy-mm-dd)", "起始时间")
If Trim(glstr1) = "" Then
tbl = 0
Glcxconcent = ""
MsgBox "请输入起始时间!", vbCritical + vbOKOnly, "警告"
Exit Sub
Else
    If Trim(glstr1) = Format(glstr1, "yyyy-mm-dd") Then
       glstr2 = InputBox("请输入起始时间(yyyy-mm-dd)", "起始时间")
          If Trim(glstr2) = "" Then
             Glcxconcent = " where [日期] ='" + Trim(glstr1) + "'"
             tbl = 1
             Glrptfrm.Show
             Exit Sub
          Else
              If Trim(glstr2) = Format(glstr2, "yyyy-mm-dd") Then
                 tbl = 3
                 Glcxconcent = " where [日期] >='" + Trim(glstr1) + "' and [日期]<='" + Trim(glstr2) + "'"
                 Glrptfrm.Show
                 Exit Sub
              Else
                 tbl = 0
                 Glcxconcent = ""
                 MsgBox "请输入正确的终止时间格式!!", vbCritical + vbOKOnly, "警告"
                 Exit Sub
              End If

          End If
          
    ElseIf Trim(glstr1) = Format(glstr1, "yyyy-mm") Then
           Glcxconcent = " where [日期] between '" + Trim(glstr1) + "' & '-01'and '" + Trim(glstr1) + "' & '-31'"
           tbl = 2
           Glrptfrm.Show
           Exit Sub
    ElseIf IsNumeric(Trim(glstr1)) And Len(Trim(glstr1)) = 4 Then
           Glcxconcent = " where [日期] between '" + Trim(glstr1) + "' & '-01-01'and '" + Trim(glstr1) + "' & '-12-31'"
           tbl = 4
           Glrptfrm.Show
           Exit Sub
   Else
        MsgBox "请输入正确的起始时间格式!", vbCritical + vbOKOnly, "警告"
        Exit Sub
   End If
End If
End Sub

Private Sub Form_Load()
'If benci = False Then
Gldata.DatabaseName = App.Path & "\Report\report.mdb"
Gldata.RecordsetType = 1
Gldata.RecordSource = "select * from glthis order by 时间 asc"
'Gldata.RecordSource = glrptgrid
'Exit Sub
'Else
'
'
'Exit Sub
'End If

End Sub

⌨️ 快捷键说明

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