frmcount.frm

来自「这个是VB环境开发的,我也是转载的把原来的Access数据库改成了SQl Ser」· FRM 代码 · 共 610 行 · 第 1/2 页

FRM
610
字号
         EndProperty
         ColumnCount     =   4
         BeginProperty Column00 
            DataField       =   "pname"
            Caption         =   "元件名称"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "ptype"
            Caption         =   "元件型号"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "总金额"
            Caption         =   "总金额"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "数量"
            Caption         =   "数量"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
               ColumnWidth     =   1365.165
            EndProperty
            BeginProperty Column01 
               ColumnWidth     =   2684.977
            EndProperty
            BeginProperty Column02 
               Object.Visible         =   -1  'True
            EndProperty
            BeginProperty Column03 
            EndProperty
         EndProperty
      End
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Align           =   1  'Align Top
      Height          =   555
      Left            =   0
      TabIndex        =   5
      Top             =   0
      Width           =   7800
      _ExtentX        =   13758
      _ExtentY        =   979
      ButtonWidth     =   979
      ButtonHeight    =   926
      Appearance      =   1
      Style           =   1
      ImageList       =   "ImageList1"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   3
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "筛 选"
            Key             =   "sele"
            ImageIndex      =   4
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "打印"
            Key             =   "print"
            ImageIndex      =   5
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "退 出"
            Key             =   "exit"
            ImageIndex      =   6
         EndProperty
      EndProperty
      Begin MSComDlg.CommonDialog dlg 
         Left            =   5400
         Top             =   0
         _ExtentX        =   847
         _ExtentY        =   847
         _Version        =   393216
      End
      Begin MSComctlLib.ImageList ImageList1 
         Left            =   7080
         Top             =   0
         _ExtentX        =   1005
         _ExtentY        =   1005
         BackColor       =   -2147483643
         ImageWidth      =   16
         ImageHeight     =   16
         MaskColor       =   12632256
         _Version        =   393216
         BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
            NumListImages   =   6
            BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frmcount.frx":3F98
               Key             =   ""
            EndProperty
            BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frmcount.frx":4614
               Key             =   ""
            EndProperty
            BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frmcount.frx":4C90
               Key             =   ""
            EndProperty
            BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frmcount.frx":4DA4
               Key             =   ""
            EndProperty
            BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frmcount.frx":5420
               Key             =   ""
            EndProperty
            BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frmcount.frx":5A9C
               Key             =   ""
            EndProperty
         EndProperty
      End
   End
End
Attribute VB_Name = "frmcount"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim RsFilter As New Recordset
Dim RsFilter1 As New Recordset
Public InsertType As String
Dim strSQL As String

Private Sub Command1_Click()
    
    If tab1.Tab = 0 Then
        If RsFilter.State Then
            RsFilter.Close
            Call Qery
            RsFilter.Open strSQL, cn, adOpenKeyset, adLockBatchOptimistic
            Set dtgrd.DataSource = RsFilter
        End If
     Else
        If RsFilter1.State Then
           RsFilter1.Close
           Call Qery
           RsFilter1.Open strSQL, cn, adOpenKeyset, adLockBatchOptimistic
           RsFilter1.Requery
           Set dtgrd1.DataSource = RsFilter1
        End If
    End If
End Sub

Private Sub Form_Activate()
'On Error GoTo l
'    frmcount.Top = 0
'    frmcount.Left = 0
'    Adodc1.ConnectionString = "microsoft.jet.oledb.4.0; data source=" & _
'    App.Path & "\data\jxcdb.mdb;"
'    dtpend.Value = Format(Date, "yy-mm-dd")
'    Call Qery
'    RsFilter.Open strsql, cn, adOpenKeyset, adLockBatchOptimistic
'    Set dtgrd.DataSource = RsFilter
'    Exit Sub
'l: MsgBox err.Description
End Sub
Private Sub Qery()
  If tab1.Tab = 0 Then
    strSQL = "SELECT EleStock.Ename,EleStock.Etype, Sum(count.金额) AS 总金额, max(IOTbldetail.Date) as 日期 ,sum(count.Amount) as 数量,count.flg "
    strSQL = strSQL & "FROM IOTbldetail INNER JOIN ([count] INNER JOIN EleStock ON count.Bh = EleStock.ID) ON IOTbldetail.ID = count.ioid"
    strSQL = strSQL & " where IOTbldetail.Date  Between #" & DTPstart.Value & "# And #" & dtpend.Value & "#"
    If frmcount.Caption = "入库统计" Then
        strSQL = strSQL + " and IOTbldetail.ioflg=true  "
    Else
        strSQL = strSQL + " and IOTbldetail.ioflg=false  "
    End If
    strSQL = strSQL + "GROUP BY EleStock.Ename,EleStock.Etype,count.flg "
    strSQL = strSQL + " HAVING (((count.Flg)<>'成品'))"
  Else
    strSQL = "SELECT proStock.pname,proStock.ptype, Sum(count.金额) AS 总金额, max(IOTbldetail.Date) as 日期 ,sum(count.Amount) as 数量,count.flg "
    strSQL = strSQL & "FROM IOTbldetail INNER JOIN ([count] INNER JOIN proStock ON count.Bh = proStock.ID) ON IOTbldetail.ID = count.ioid"
    strSQL = strSQL & " where IOTbldetail.Date  Between #" & DTPstart.Value & "# And #" & dtpend.Value & "#"
    If frmcount.Caption = "入库统计" Then
        strSQL = strSQL + " and ioflg=true  "
    Else
        strSQL = strSQL + " and ioflg=false  "
    End If
    strSQL = strSQL + "GROUP BY proStock.pname,proStock.ptype,count.flg "
    strSQL = strSQL + " HAVING (((count.Flg)='成品'))"
  End If
End Sub

Private Sub Form_Load()
On Error GoTo l
    frmcount.Top = 0
    frmcount.Left = 0
    Adodc1.ConnectionString = "microsoft.jet.oledb.4.0; data source=" & _
    App.Path & "\data\jxcdb.mdb;"
    dtpend.Value = Format(Date, "yy-mm-dd")
    Call Qery
    RsFilter.Open strSQL, cn, adOpenKeyset, adLockBatchOptimistic
    Set dtgrd.DataSource = RsFilter
    Exit Sub
l: MsgBox err.Description
End Sub

Private Sub Form_Unload(Cancel As Integer)
    If RsFilter.State Then
      RsFilter.Close
    End If
    If RsFilter1.State Then
     RsFilter1.Close
    End If
End Sub



Private Sub tab1_Click(PreviousTab As Integer)
  If PreviousTab = 0 Then
   Call Qery
   'Command1_Click]
   If RsFilter1.State Then
      RsFilter1.Close
      Call Qery
   End If
   RsFilter1.Open strSQL, cn, adOpenKeyset, adLockBatchOptimistic
   Set dtgrd1.DataSource = RsFilter1
  End If
End Sub


Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
    Select Case Button.Key
        Case "exit"
            Unload Me
        Case "sele"
            Command1_Click
        Case "print"
        If tab1.Tab = 0 Then
           If RsFilter.State Then
                RsFilter.Close
                Call Qery
                RsFilter.Open strSQL, cn, adOpenKeyset, adLockBatchOptimistic
                If RsFilter.EOF Or RsFilter.BOF Then
                   Exit Sub
                End If
                dlg.Orientation = 2
                dlg.ShowPrinter
                Set dtReportCount.DataSource = RsFilter
                If frmcount.Caption = "入库统计" Then
                    dtReportCount.Title = " 入库统计 "
                Else
                   dtReportCount.Title = " 出库统计 "
                End If
                dtReportCount.Show
            End If
     Else
        If RsFilter1.State Then
           RsFilter1.Close
           Call Qery
           RsFilter1.Open strSQL, cn, adOpenKeyset, adLockBatchOptimistic
           RsFilter1.Requery
           If RsFilter.EOF Or RsFilter.BOF Then
              Exit Sub
           End If
           dlg.ShowPrinter
           Set dtreportcount1.DataSource = RsFilter1
           If frmcount.Caption = "入库统计" Then
           dtReportCount.Title = " 入库统计 "
           Else
            dtReportCount.Title = " 出库统计 "
           End If
           dtreportcount1.Show
        End If
    End If
    End Select
End Sub

⌨️ 快捷键说明

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