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

📄 frminquery.frm

📁 用vb写的饮食管理系统功能全面
💻 FRM
字号:
VERSION 5.00
Object = "{4932CEF1-2CAA-11D2-A165-0060081C43D9}#2.0#0"; "Actbar2.ocx"
Object = "{FDAC2480-F4ED-4632-AA78-DCA210A74E49}#6.0#0"; "SPR32X60.ocx"
Begin VB.Form frminquery 
   AutoRedraw      =   -1  'True
   Caption         =   "Form2"
   ClientHeight    =   5925
   ClientLeft      =   1680
   ClientTop       =   2655
   ClientWidth     =   7860
   LinkTopic       =   "Form2"
   MDIChild        =   -1  'True
   ScaleHeight     =   5925
   ScaleWidth      =   7860
   Begin ActiveBar2LibraryCtl.ActiveBar2 Abar 
      Align           =   1  'Align Top
      Height          =   5925
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   7860
      _LayoutVersion  =   1
      _ExtentX        =   13864
      _ExtentY        =   10451
      _DataPath       =   ""
      Bands           =   "frminquery.frx":0000
      Begin VB.PictureBox Pic 
         Height          =   6255
         Left            =   30
         ScaleHeight     =   6195
         ScaleWidth      =   8805
         TabIndex        =   1
         Top             =   210
         Width           =   8865
         Begin VB.Data siteData 
            Caption         =   "Data1"
            Connect         =   "Access"
            DatabaseName    =   ""
            DefaultCursorType=   0  '缺省游标
            DefaultType     =   2  '使用 ODBC
            Exclusive       =   0   'False
            Height          =   285
            Left            =   420
            Options         =   0
            ReadOnly        =   0   'False
            RecordsetType   =   1  'Dynaset
            RecordSource    =   ""
            Top             =   6540
            Width           =   1140
         End
         Begin FPSpread.vaSpread fpsp 
            Bindings        =   "frminquery.frx":0260
            Height          =   5385
            Left            =   180
            TabIndex        =   2
            Top             =   240
            Width           =   7515
            _Version        =   393216
            _ExtentX        =   13256
            _ExtentY        =   9499
            _StockProps     =   64
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            SpreadDesigner  =   "frminquery.frx":0277
         End
      End
   End
End
Attribute VB_Name = "frminquery"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Dim rst As Recordset
Dim dbs As Database
Public qstr As String

Private Sub ABar_ToolClick(ByVal Tool As ActiveBar2LibraryCtl.Tool)
On Error GoTo er
    Select Case Tool.Name
        Case "m_query"
            Load frmInSearch
            frmInSearch.FormLoad "frmInSearch"
            
            fpsp.Visible = False
            rst.Close
            Set rst = dbs.OpenRecordset(qstr, dbOpenDynaset)
            InitGrid
            
        Case "m_print"
            InitGrid
            tmp = "座位名称" & Space(10) & "容纳人数" & Space(10) & "台位费"
            Printer.Print tmp
            Printer.Print "========================================="
            Do While Not rst.EOF
                tmp = rst!siteName & Space(10) & rst!PersonerN & Space(10) & rst!SitePay
                Printer.Print tmp
                rst.MoveNext
            Loop
            
        Case "m_exit"
            Unload Me
    End Select
    Exit Sub
er:
    ErrorHandle ""
    
End Sub



Private Sub Form_Activate()
    InitGrid
End Sub

Private Sub Form_Load()

Dim t As ActiveBar2LibraryCtl.Tool
Dim b As ActiveBar2LibraryCtl.Band
Dim keys(0) As New ShortCut

GetFormSet Me, frmMain
    Debug.Print Me.Width
    
    Abar.ClientAreaControl = Pic
    Me.Icon = LoadResPicture(227, vbResIcon)
    Me.Caption = "进货一览"
    Set Tool = Abar.Tools.Add(0, "Separator")
    With Tool
        .Caption = ""
        .Category = "Format"
        .ControlType = ddTTSeparator
    End With
   
    
    Set b = Abar.Bands.Add("toolsMain")
        b.Type = ddBTNormal
        b.Caption = "工具条"
        b.DisplayMoreToolsButton = False
        b.DockingArea = ddDATop
        b.MouseTracking = ddTSBevel
        b.GrabHandleStyle = ddGSNormal

    Set t = Abar.Tools.Add(GetUniqueToolID(), "m_query")
    With t
        .Caption = "查询"
        .SetPicture ddITNormal, LoadResPicture(101, vbResBitmap)
        .ControlType = ddTTButton
        keys(0) = "Control+Q"
        .ShortCuts = keys
        .ToolTipText = "查询进货情况"
        .CaptionPosition = ddCPRight
        .Style = ddSIconText
    End With
    
    
    Set t = Abar.Tools.Add(GetUniqueToolID(), "m_print")
    With t
        .Caption = "打印"
        .SetPicture ddITNormal, LoadResPicture(106, vbResBitmap)
        .ControlType = ddTTButton
        keys(0) = "Control+Q"
        .ShortCuts = keys
        .ToolTipText = "打印"
        .CaptionPosition = ddCPBelow
        .Style = ddSIconText
    End With
    
    Set t = Abar.Tools.Add(GetUniqueToolID(), "m_exit")
    With t
        .Caption = "关闭": Tool.Category = "m_sys"
        .SetPicture ddITNormal, LoadResPicture(103, vbResBitmap)
        .ControlType = ddTTButton
        keys(0) = "Control+C"
        .ShortCuts = keys
        .ToolTipText = "关闭本窗口"
        .CaptionPosition = ddCPBelow
        .Style = ddSIconText
    
    End With
    With b.Tools

        .Insert .Count, Abar.Tools("m_query")
        
        .Insert .Count, Abar.Tools("Separator")
        
        .Insert .Count, Abar.Tools("m_print")
        
        .Insert .Count, Abar.Tools("Separator")
                
        .Insert .Count, Abar.Tools("m_exit")
       
    End With

    Abar.RecalcLayout
    Abar.Refresh
    
    qstr = "Select * From storelisthis"
    Set dbs = OpenDatabase(ConData, False, False, Constr)
    Set rst = dbs.OpenRecordset(qstr, dbOpenDynaset)
    
    Set siteData.Recordset = rst
    fpsp.OperationMode = OperationModeRow
    
    fpsp.SelBackColor = &HFFC0C0
    
End Sub

Private Sub InitGrid()
         
    
    With fpsp
    
        .Visible = False
        rst.Requery
        
        .UnitType = UnitTypeTwips
    
        .RowHeight(0) = 500
        
        .MaxRows = rst.RecordCount
        .MaxCols = rst.Fields.Count
        
        .Row = 0
        .Row2 = .MaxRows
        .Col = 1
        .Col2 = .MaxCols
        
        .BlockMode = True
        .Protect = True
        .FontName = "宋体"
        .FontSize = "9.25"
        .Lock = True
        .BlockMode = False
        
         .Row = 0
         .Row2 = 0
         .Col = 1
         .Col2 = .MaxCols
         .Clip = "序号" & Chr(9) & "类别" & Chr(9) & "名称" & Chr(9) & "单位" & Chr(9) & "单价" & Chr(9) & "数量" & Chr(9) & "金额" & Chr(9) & "日期"
        
    
        .ColWidth(1) = 0
        .ColWidth(2) = 1200
        .ColWidth(3) = 1200
        .ColWidth(4) = 800
        .ColWidth(5) = 1000
        .ColWidth(6) = 800
        .ColWidth(7) = 1200
        .ColWidth(8) = 1200
        
        .Visible = True
    End With
        

        
End Sub
Private Sub Form_Unload(Cancel As Integer)
    rst.Close
    Set rst = Nothing
    dbs.Close
    Set dbs = Nothing
    SaveFormSet Me
End Sub

Private Sub ccancle_Click()
    Fredit.Enabled = False
    fpsp.Enabled = True
    
    
    With fpsp
        .Row = .ActiveRow
        .Col = 1
        Tname.Text = fpsp.Text
        .Col = 2
        Trs.Text = fpsp.Text
        .Col = 3
        Tsp.Text = .Value

    End With
    Abar.Tools("m_add").Enabled = True
    Abar.Tools("m_modify").Enabled = True
    Abar.Tools("m_del").Enabled = True
    Abar.Tools("m_print").Enabled = True
End Sub


Private Sub cok_Click()
On Error GoTo er
    If CheckOK() Then
        If CurrOp = "add" Then
            sqlstr = "Insert into site (SiteName,PersonerN,SitePay) values('" & Trim(Tname.Text) & "'," & Trim(Trs.Text) & "," & Trim(Tsp.Text) & ")"
            dbs.Execute sqlstr
        
        Else
            fpsp.Row = fpsp.ActiveRow
            fpsp.Col = 1
            t = fpsp.Text
            dbs.Execute "update site set SiteName ='" & Tname.Text & "'" & _
                                          ",PersonerN=" & Trs.Text & _
                                          ",SitePay=" & Tsp.Text & " where sitename = '" & t & "';"
        End If
        rst.Requery
        InitGrid
        Fredit.Enabled = False
        fpsp.Enabled = True
        Abar.Tools("m_add").Enabled = True
        Abar.Tools("m_modify").Enabled = True
        Abar.Tools("m_del").Enabled = True
        Abar.Tools("m_print").Enabled = True
        
    End If
    

    Exit Sub
er:
    ErrorHandle ""
    Fredit.Enabled = False
    fpsp.Enabled = True
    
    Abar.Tools("m_add").Enabled = True
    Abar.Tools("m_modify").Enabled = True
    Abar.Tools("m_del").Enabled = True
    Abar.Tools("m_print").Enabled = True

End Sub


Private Sub fpsp_LeaveRow(ByVal Row As Long, ByVal RowWasLast As Boolean, ByVal RowChanged As Boolean, ByVal AllCellsHaveData As Boolean, ByVal NewRow As Long, ByVal NewRowIsLast As Long, Cancel As Boolean)
    With fpsp
        .Row = NewRow
        .Col = 1
        Tname.Text = .Text
        .Col = 2
        Trs.Text = .Text
        .Col = 3
        Tsp.Text = .Value
        
    End With
    
End Sub



Private Sub Pic_Resize()
On Error Resume Next
    fpsp.Left = 0
    fpsp.Top = 0
    fpsp.Height = Pic.Height - 50
    fpsp.Width = Pic.Width - 50
End Sub

Private Sub Trs_Change()

End Sub

Private Sub Tsp_Validate(Cancel As Boolean)
    If Not IsNumeric(Tsp.Text) Then
        MsgBox Tsp.Text & "不是有效的台位费,‘台位费’必须为数字!", vbCritical, "提示"
        Cancel = True
    
        Tsp.SetFocus
        
    End If

End Sub

Private Sub VSrs_Change()
    Trs.Text = VSrs.Value
End Sub


Private Function CheckOK() As Boolean

    CheckOK = False
    
    If Len(Tname.Text) > 0 Then
        If Not IsNumeric(Tsp.Text) Then
            MsgBox Tsp.Text & "不是有效的台位费,‘台位费’必须为数字!", vbCritical, "提示"
            Tsp.SetFocus
            Exit Function
        End If
    Else
        MsgBox Te.Text & "座位名称不能为空!", vbCritical, "提示"
        Tname.SetFocus
        Exit Function
    End If
    CheckOK = True
End Function

Private Sub Tname_GotFocus()
    SendKeys "{Home}+{End}"
End Sub

Private Sub Tsp_GotFocus()
    SendKeys "{Home}+{End}"
End Sub




⌨️ 快捷键说明

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