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

📄 form3.frm

📁 本人下载的另一个VISUAL BACIC的定单管理系统~很有特点
💻 FRM
字号:
VERSION 5.00
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Begin VB.Form Form3 
   Caption         =   "订单查询"
   ClientHeight    =   8535
   ClientLeft      =   165
   ClientTop       =   450
   ClientWidth     =   11880
   LinkTopic       =   "Form3"
   ScaleHeight     =   8535
   ScaleWidth      =   11880
   StartUpPosition =   3  '窗口缺省
   Begin MSDBGrid.DBGrid DBGrid1 
      Bindings        =   "Form3.frx":0000
      Height          =   5535
      Left            =   120
      OleObjectBlob   =   "Form3.frx":0019
      TabIndex        =   6
      Top             =   1920
      Width           =   11055
   End
   Begin VB.CommandButton Command2 
      Caption         =   "退   出"
      Height          =   495
      Left            =   9960
      TabIndex        =   5
      Top             =   960
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "查   询"
      Height          =   495
      Left            =   8400
      TabIndex        =   4
      Top             =   960
      Width           =   975
   End
   Begin VB.Frame Frame 
      Caption         =   "请选择查询条件"
      Height          =   975
      Left            =   120
      TabIndex        =   1
      Top             =   600
      Width           =   8055
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   3120
         TabIndex        =   3
         Top             =   360
         Width           =   4575
      End
      Begin VB.ComboBox Combo1 
         Height          =   315
         Left            =   240
         TabIndex        =   2
         Text            =   "Combo1"
         Top             =   360
         Width           =   2535
      End
   End
   Begin VB.Data Datasearch 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   "F:\作业\作业\database2.mdb"
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   375
      Left            =   720
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   7680
      Visible         =   0   'False
      Width           =   3615
   End
   Begin VB.Line Line1 
      X1              =   0
      X2              =   11160
      Y1              =   1800
      Y2              =   1800
   End
   Begin VB.Label Label1 
      Caption         =   "分类查询:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   360
      TabIndex        =   0
      Top             =   240
      Width           =   1455
   End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim sSearch As String  '搜索字符串
Dim sSql As String    '记录集SQL
Dim db As Database
Dim rs As Recordset
Dim iWidth(8) As Integer
Dim Heads(8) As String
Dim spath As String
Private Sub QuerySell(NameFind As String, ItemName As String)

    On Error Resume Next

    Me.MousePointer = 11
    
    Dim MargeRowBN As String, X As Integer, tmpBNX As String, ZF As String
    Dim MargeRow As String, tmpBN As String
    Dim tmpStr As String
    
    '配置网格
    
    Dim StoreQueryString As String
    
    Select Case sSearch
           Case ""
               StoreQueryString = tmpSql
           Case Is <> ""
        StoreQueryString = tmpSql + " Where " & sSearch
    End Select
   

    Grid1.Clear
    Grid1.Cols = 14
    Grid1.FormatString = "^..|^ orderid|^ productname|^ producttype|^ customername |^ operatorname |^ destination |^ price |^ number |^ total |^ transport |^ pay |^orderdate|^finishdate|^status"
    'Grid1.ColWidth(0) = 200
    'Grid1.ColWidth(1) = 1600
    'Grid1.ColWidth(2) = 1600
    'Grid1.ColWidth(3) = 1000
    'Grid1.ColWidth(4) = 1400
    'Grid1.ColWidth(5) = 1200
    'Grid1.ColWidth(6) = 1600
    'Grid1.ColWidth(7) = 1600
    'Grid1.ColWidth(8) = 1200
    'Grid1.ColWidth(9) = 1200
    'Grid1.ColWidth(10) = 1000



    On Error Resume Next
    
    HH = 1
    Do While Not rs.EOF()
       Grid1.Row = HH
       Grid1.Col = 1
       Grid1.CellAlignment = 4
       Debug.Print rs.Fields(ItemName)
       tmpStr = rs.Fields(ItemName)
       
        If tmpStr Like NameFind Then
        
            If Not IsNull(rs.Fields("orderid").Value) Then
               Grid1.Text = rs.Fields("orderid").Value
            End If
               Grid1.Col = 2
               Grid1.CellAlignment = 1
            If Not IsNull(rs.Fields("productname").Value) Then
               Grid1.Text = rs.Fields("productname").Value
            End If
               Grid1.Col = 3
               Grid1.CellAlignment = 1
            If Not IsNull(rs.Fields("producttype").Value) Then
               Grid1.Text = rs.Fields("producttype").Value
            End If
               Grid1.Col = 4
               Grid1.CellAlignment = 1
            If Not IsNull(rs.Fields("customername").Value) Then
               Grid1.Text = rs.Fields("customername").Value
            End If
               Grid1.Col = 5
               Grid1.CellAlignment = 1
            If Not IsNull(rs.Fields("operatorname").Value) Then
               Grid1.Text = rs.Fields("operatorname").Value
            End If
               Grid1.Col = 6
               Grid1.CellAlignment = 1
            If Not IsNull(rs.Fields("destination").Value) Then
               Grid1.Text = rs.Fields("destination").Value
            End If
               Grid1.Col = 7
               Grid1.CellAlignment = 1
            If Not IsNull(rs.Fields("price").Value) Then
               Grid1.Text = rs.Fields("price").Value
            End If
               Grid1.Col = 8
               Grid1.CellAlignment = 1
            If Not IsNull(rs.Fields("number").Value) Then
               Grid1.Text = rs.Fields("number").Value
            End If
               Grid1.Col = 9
               Grid1.CellAlignment = 1
            If Not IsNull(rs.Fields("total").Value) Then
               Grid1.Text = rs.Fields("total").Value
            End If
               Grid1.Col = 10
               Grid1.CellAlignment = 1
            If Not IsNull(rs.Fields("transport").Value) Then
               Grid1.Text = rs.Fields("transport").Value
            End If
            Grid1.Col = 11
               Grid1.CellAlignment = 1
            If Not IsNull(rs.Fields("pay").Value) Then
               Grid1.Text = rs.Fields("pay").Value
            End If
            Grid1.Col = 12
               Grid1.CellAlignment = 1
            If Not IsNull(rs.Fields("orderdate").Value) Then
               Grid1.Text = rs.Fields("orderdate").Value
            End If
            Grid1.Col = 13
               Grid1.CellAlignment = 1
            If Not IsNull(rs.Fields("finishdate").Value) Then
               Grid1.Text = rs.Fields("finishdate").Value
            End If
            Grid1.Col = 14
               Grid1.CellAlignment = 1
            If Not IsNull(rs.Fields("status").Value) Then
               Grid1.Text = rs.Fields("status").Value
            End If
            HH = HH + 1
            Grid1.Rows = HH + 1
        End If
        rs.MoveNext
    Loop
    rs.Close
    db.Close
    
    Grid1.Visible = True
    Me.MousePointer = 0
 
End Sub

Private Sub customername_Click()
    customernamequery = InputBox("Enter A customername To Search For", "customername Query")
    QuerySell CStr(customernamequery), "customername"
End Sub

Private Sub finishdate_Click()
    finishdatequery = InputBox("Enter A finishdate To Search For", "finishdate Query")
    QuerySell CStr(finishdatequery), "finishdate"
End Sub

Private Sub operatorname_Click()
    operatornamequery = InputBox("Enter A operatorname To Search For", "operatorname Query")
    QuerySell CStr(operatornamequery), "operatorname"
End Sub

Private Sub orderdate_Click()
    orderdatequery = InputBox("Enter A orderdate To Search For", "orderdate Query")
    QuerySell CStr(orderdatequery), "orderdate"
End Sub

Private Sub orderid_Click()
orderidquery = InputBox("Enter A OrderID To Search For", "OrderId Query")
QuerySell LCase(orderidquery), "OrderID"
End Sub
 
Private Sub Command1_Click()

Dim searchtype As String

If Combo1.Text = "订单编号" Then
    searchid = "orderid"
    Datasearch.RecordSource = "select * from sub where (sub." & searchid & " = " & Text1.Text & ")"
    Datasearch.Refresh
Else

If Combo1.Text = "产品名称" Then
    searchtype = "productname"
End If

If Combo1.Text = "产品型号" Then
    searchtype = "producttype"
End If

If Combo1.Text = "操作员" Then
    searchtype = "operatorname"
End If

If Combo1.Text = "客户名称" Then
    searchtype = "customername"
End If

If Combo1.Text = "订单日期" Then
    searchtype = "orderdate"
End If

If Combo1.Text = "截止日期" Then
    searchtype = "finishdate"
End If

Datasearch.RecordSource = "select * from sub where (sub." & searchtype & " " & " like " + Chr(34) + "*" + Text1.Text + "*" + Chr(34) + ") order by orderid "
Datasearch.Refresh

End If

If Datasearch.Recordset.RecordCount = 0 Then
    MsgBox "没有符合条件的订单!", , "提示"
End If



' If rs.EOF = False Then
 '       Call DisplayKeysetGrid(Grid1, Heads(), iWidth())
  '  End If


End Sub

Private Sub Command2_Click()

Unload Me

End Sub

Private Sub Form_Load()
Set db = OpenDatabase(App.Path + "/database2.mdb")
Set rs = db.OpenRecordset("sub")



spath = App.Path
    If Right$(spath, 1) <> "\" Then spath = spath & "\"
    spath = spath & "database2.mdb"
    Datasearch.DatabaseName = spath
    
    
Heads(0) = "订单编号"
    Heads(1) = "产品名称"
    Heads(2) = "产品型号"
    Heads(3) = "操作员"
    Heads(4) = "客户名称"
    Heads(5) = "订单日期"
    Heads(6) = "截止日期"
    iWidth(0) = 600
    iWidth(1) = 600
    iWidth(2) = 800
    iWidth(3) = 800
    iWidth(4) = 800
    iWidth(5) = 800
    iWidth(6) = 800
    
End Sub
Private Sub form_activate()

Combo1.AddItem ("订单编号")
Combo1.AddItem ("产品名称")
Combo1.AddItem ("产品型号")
Combo1.AddItem ("操作员")
Combo1.AddItem ("客户名称")
Combo1.AddItem ("订单日期")
Combo1.AddItem ("截止日期")
Combo1.ListIndex = 0

End Sub

Private Sub productname_Click()
    productnamequery = InputBox("Enter A productname To Search For", "productname Query")
    QuerySell CStr(productnamequery), "productname"
End Sub

Private Sub producttype_Click()
    productTypequery = InputBox("Enter A productType To Search For", "productType Query")
    QuerySell CStr(productTypequery), "productType"
End Sub

⌨️ 快捷键说明

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