frmStock.frm
上传用户:xianglong
上传日期:2022-06-19
资源大小:1105k
文件大小:20k
源码类别:

控制台编程

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
  3. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
  4. Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
  5. Begin VB.Form frmMaterial 
  6.    BorderStyle     =   1  'Fixed Single
  7.    Caption         =   "物料信息的建立与维护"
  8.    ClientHeight    =   6780
  9.    ClientLeft      =   2040
  10.    ClientTop       =   660
  11.    ClientWidth     =   8565
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   6780
  16.    ScaleWidth      =   8565
  17.    StartUpPosition =   1  '所有者中心
  18.    Begin VB.CommandButton comDate 
  19.       Height          =   600
  20.       Left            =   2160
  21.       Picture         =   "frmStock.frx":0000
  22.       Style           =   1  'Graphical
  23.       TabIndex        =   23
  24.       Top             =   2280
  25.       Width           =   615
  26.    End
  27.    Begin MSComctlLib.Toolbar Tlbar 
  28.       Align           =   1  'Align Top
  29.       Height          =   810
  30.       Left            =   0
  31.       TabIndex        =   0
  32.       Top             =   0
  33.       Width           =   8565
  34.       _ExtentX        =   15108
  35.       _ExtentY        =   1429
  36.       ButtonWidth     =   1032
  37.       ButtonHeight    =   1376
  38.       Appearance      =   1
  39.       Style           =   1
  40.       ImageList       =   "ImList2"
  41.       _Version        =   393216
  42.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  43.          NumButtons      =   9
  44.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  45.             Caption         =   "增加"
  46.             Key             =   "Add"
  47.             ImageIndex      =   1
  48.          EndProperty
  49.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  50.             Style           =   3
  51.          EndProperty
  52.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  53.             Caption         =   "修改"
  54.             Key             =   "Edit"
  55.             ImageIndex      =   2
  56.          EndProperty
  57.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  58.             Style           =   3
  59.          EndProperty
  60.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  61.             Caption         =   "保存"
  62.             Key             =   "Save"
  63.             ImageIndex      =   3
  64.          EndProperty
  65.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  66.             Style           =   3
  67.          EndProperty
  68.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  69.             Caption         =   "删除"
  70.             Key             =   "Del"
  71.             ImageIndex      =   4
  72.          EndProperty
  73.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  74.             Style           =   3
  75.          EndProperty
  76.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  77.             Caption         =   "退出"
  78.             Key             =   "Exit"
  79.             ImageIndex      =   5
  80.          EndProperty
  81.       EndProperty
  82.    End
  83.    Begin VB.TextBox txtDate 
  84.       Height          =   320
  85.       Left            =   1200
  86.       TabIndex        =   13
  87.       Top             =   2520
  88.       Width           =   975
  89.    End
  90.    Begin MSComCtl2.MonthView MonthView1 
  91.       Height          =   2220
  92.       Left            =   2160
  93.       TabIndex        =   12
  94.       Top             =   2760
  95.       Width           =   4065
  96.       _ExtentX        =   7170
  97.       _ExtentY        =   3916
  98.       _Version        =   393216
  99.       ForeColor       =   -2147483630
  100.       BackColor       =   8438015
  101.       Appearance      =   1
  102.       StartOfWeek     =   25559041
  103.       CurrentDate     =   39125
  104.    End
  105.    Begin VB.Data d1 
  106.       Caption         =   "Data1"
  107.       Connect         =   "Access"
  108.       DatabaseName    =   ""
  109.       DefaultCursorType=   0  '缺省游标
  110.       DefaultType     =   2  '使用 ODBC
  111.       Exclusive       =   0   'False
  112.       Height          =   372
  113.       Left            =   2520
  114.       Options         =   0
  115.       ReadOnly        =   0   'False
  116.       RecordsetType   =   1  'Dynaset
  117.       RecordSource    =   ""
  118.       Top             =   5040
  119.       Visible         =   0   'False
  120.       Width           =   1692
  121.    End
  122.    Begin VB.TextBox txtChange 
  123.       Height          =   288
  124.       Left            =   7200
  125.       TabIndex        =   10
  126.       Top             =   1800
  127.       Width           =   1095
  128.    End
  129.    Begin VB.TextBox txtVol 
  130.       Height          =   288
  131.       Left            =   5160
  132.       TabIndex        =   9
  133.       Top             =   1320
  134.       Width           =   975
  135.    End
  136.    Begin VB.TextBox txtVolPrice 
  137.       Height          =   288
  138.       Left            =   5160
  139.       TabIndex        =   8
  140.       Top             =   1800
  141.       Width           =   975
  142.    End
  143.    Begin VB.TextBox txtToday 
  144.       Height          =   288
  145.       Left            =   3240
  146.       TabIndex        =   7
  147.       Top             =   1800
  148.       Width           =   975
  149.    End
  150.    Begin VB.TextBox txtLast 
  151.       Height          =   288
  152.       Left            =   3240
  153.       TabIndex        =   6
  154.       Top             =   1320
  155.       Width           =   975
  156.    End
  157.    Begin VB.TextBox txtName 
  158.       Height          =   288
  159.       Left            =   1200
  160.       TabIndex        =   5
  161.       Top             =   1800
  162.       Width           =   975
  163.    End
  164.    Begin VB.Frame Frame2 
  165.       Caption         =   "物料信息"
  166.       ForeColor       =   &H00000000&
  167.       Height          =   2172
  168.       Left            =   120
  169.       TabIndex        =   3
  170.       Top             =   840
  171.       Width           =   8295
  172.       Begin VB.TextBox txtInventory 
  173.          Height          =   288
  174.          Left            =   7080
  175.          TabIndex        =   26
  176.          Top             =   1680
  177.          Width           =   1095
  178.       End
  179.       Begin VB.ComboBox Combo1 
  180.          Height          =   300
  181.          Left            =   7080
  182.          TabIndex        =   11
  183.          Top             =   480
  184.          Width           =   1095
  185.       End
  186.       Begin VB.TextBox txtCode 
  187.          Height          =   288
  188.          Left            =   1080
  189.          TabIndex        =   4
  190.          Top             =   480
  191.          Width           =   975
  192.       End
  193.       Begin VB.Label Label9 
  194.          BackStyle       =   0  'Transparent
  195.          Caption         =   "库    存:"
  196.          ForeColor       =   &H00000000&
  197.          Height          =   255
  198.          Left            =   6120
  199.          TabIndex        =   25
  200.          Top             =   1680
  201.          Width           =   975
  202.       End
  203.       Begin VB.Label Label6 
  204.          BackStyle       =   0  'Transparent
  205.          Caption         =   "物料名称:"
  206.          ForeColor       =   &H00000000&
  207.          Height          =   255
  208.          Left            =   120
  209.          TabIndex        =   22
  210.          Top             =   960
  211.          Width           =   855
  212.       End
  213.       Begin VB.Label Label2 
  214.          BackStyle       =   0  'Transparent
  215.          Caption         =   "昨日金额:"
  216.          ForeColor       =   &H00000000&
  217.          Height          =   255
  218.          Left            =   2160
  219.          TabIndex        =   21
  220.          Top             =   480
  221.          Width           =   855
  222.       End
  223.       Begin VB.Label Label3 
  224.          BackStyle       =   0  'Transparent
  225.          Caption         =   "物料类型:"
  226.          ForeColor       =   &H00000000&
  227.          Height          =   255
  228.          Index           =   0
  229.          Left            =   6120
  230.          TabIndex        =   20
  231.          Top             =   480
  232.          Width           =   975
  233.       End
  234.       Begin VB.Label Label7 
  235.          BackStyle       =   0  'Transparent
  236.          Caption         =   "今日金额:"
  237.          ForeColor       =   &H00000000&
  238.          Height          =   255
  239.          Left            =   2160
  240.          TabIndex        =   19
  241.          Top             =   960
  242.          Width           =   855
  243.       End
  244.       Begin VB.Label Label8 
  245.          BackStyle       =   0  'Transparent
  246.          Caption         =   "日均额:"
  247.          ForeColor       =   &H00000000&
  248.          Height          =   255
  249.          Left            =   4200
  250.          TabIndex        =   18
  251.          Top             =   960
  252.          Width           =   735
  253.       End
  254.       Begin VB.Label Label5 
  255.          BackStyle       =   0  'Transparent
  256.          Caption         =   "涨    跌:"
  257.          ForeColor       =   &H00000000&
  258.          Height          =   255
  259.          Left            =   6120
  260.          TabIndex        =   17
  261.          Top             =   960
  262.          Width           =   975
  263.       End
  264.       Begin VB.Label Label10 
  265.          BackStyle       =   0  'Transparent
  266.          Caption         =   "日    期:"
  267.          ForeColor       =   &H00000000&
  268.          Height          =   255
  269.          Left            =   120
  270.          TabIndex        =   16
  271.          Top             =   1680
  272.          Width           =   855
  273.       End
  274.       Begin VB.Label Label4 
  275.          BackStyle       =   0  'Transparent
  276.          Caption         =   "日耗量:"
  277.          ForeColor       =   &H00000000&
  278.          Height          =   255
  279.          Left            =   4200
  280.          TabIndex        =   15
  281.          Top             =   480
  282.          Width           =   735
  283.       End
  284.       Begin VB.Label Label1 
  285.          Caption         =   "物料代码:"
  286.          ForeColor       =   &H00000000&
  287.          Height          =   255
  288.          Left            =   120
  289.          TabIndex        =   14
  290.          Top             =   480
  291.          Width           =   855
  292.       End
  293.    End
  294.    Begin MSComctlLib.StatusBar sbr 
  295.       Align           =   2  'Align Bottom
  296.       Height          =   375
  297.       Left            =   0
  298.       TabIndex        =   1
  299.       Top             =   6405
  300.       Width           =   8565
  301.       _ExtentX        =   15108
  302.       _ExtentY        =   661
  303.       _Version        =   393216
  304.       BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
  305.          NumPanels       =   1
  306.          BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  307.          EndProperty
  308.       EndProperty
  309.    End
  310.    Begin VB.Frame Frame1 
  311.       Caption         =   "物料列表"
  312.       ForeColor       =   &H00000000&
  313.       Height          =   3135
  314.       Left            =   120
  315.       TabIndex        =   2
  316.       Top             =   3120
  317.       Width           =   8295
  318.       Begin MSComctlLib.ImageList ImList2 
  319.          Left            =   480
  320.          Top             =   1200
  321.          _ExtentX        =   1005
  322.          _ExtentY        =   1005
  323.          BackColor       =   -2147483643
  324.          ImageWidth      =   32
  325.          ImageHeight     =   32
  326.          MaskColor       =   12632256
  327.          _Version        =   393216
  328.          BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  329.             NumListImages   =   5
  330.             BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  331.                Picture         =   "frmStock.frx":08CA
  332.                Key             =   "Add"
  333.             EndProperty
  334.             BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  335.                Picture         =   "frmStock.frx":11A4
  336.                Key             =   "Edit"
  337.             EndProperty
  338.             BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  339.                Picture         =   "frmStock.frx":1A7E
  340.                Key             =   "Save"
  341.             EndProperty
  342.             BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  343.                Picture         =   "frmStock.frx":2358
  344.                Key             =   "Del"
  345.             EndProperty
  346.             BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  347.                Picture         =   "frmStock.frx":2C32
  348.                Key             =   "Exit"
  349.             EndProperty
  350.          EndProperty
  351.       End
  352.       Begin MSFlexGridLib.MSFlexGrid grid 
  353.          Bindings        =   "frmStock.frx":350C
  354.          Height          =   2775
  355.          Left            =   120
  356.          TabIndex        =   24
  357.          Top             =   240
  358.          Width           =   8055
  359.          _ExtentX        =   14208
  360.          _ExtentY        =   4895
  361.          _Version        =   393216
  362.          Cols            =   1
  363.          FixedCols       =   0
  364.          BackColor       =   16777215
  365.          ForeColor       =   16711680
  366.          BackColorFixed  =   -2147483624
  367.          BackColorSel    =   16744576
  368.          ForeColorSel    =   16777215
  369.          BackColorBkg    =   16777215
  370.          GridColor       =   0
  371.          FillStyle       =   1
  372.          GridLinesFixed  =   1
  373.          SelectionMode   =   1
  374.          AllowUserResizing=   3
  375.       End
  376.    End
  377. End
  378. Attribute VB_Name = "frmMaterial"
  379. Attribute VB_GlobalNameSpace = False
  380. Attribute VB_Creatable = False
  381. Attribute VB_PredeclaredId = True
  382. Attribute VB_Exposed = False
  383. Public dbs As Database
  384. Public filename As String
  385. Public rec As Recordset
  386. Public rec1 As Recordset
  387. Public xg As Boolean
  388. Dim TotalRecord As Integer
  389. Private Sub comDate_Click()
  390.   MonthView1.Visible = True
  391. End Sub
  392. Private Sub Form_Load()
  393. Dim MaterialType  As Variant
  394. MaterialType = Array("甲等", "乙等")
  395. For i = 0 To 1
  396.     Combo1.AddItem MaterialType(i)
  397. Next i
  398. filename = App.Path & "dbmaterialinfo2007.mdb"
  399. Set dbs = OpenDatabase(filename)
  400. Set rec = dbs.OpenRecordset("物料信息变化表")
  401. Set rec1 = dbs.OpenRecordset("物料信息表")
  402. D1.DatabaseName = filename
  403.  
  404.  Tlbar.Buttons(2).Enabled = False
  405.  Tlbar.Buttons(3).Enabled = False
  406.  Tlbar.Buttons(5).Enabled = False
  407.  AllDisEnabled
  408.  Combo1.Enabled = False
  409.  MonthView1.Visible = False
  410.  comDate.Enabled = False
  411.  
  412.  D1.RecordSource = "SELECT 物料信息变化表.ID ,物料信息变化表.Code as 物料代码,Name as 物料名称,Last as 昨日金额,Today as 今日金额,Volume as 日耗量,[Volume Price] as 日均额,Change as 涨跌,TypeName as 物料类型,Inventory as 库存,Day as 日期 FROM 物料信息变化表,物料信息表,物料类型信息表  WHERE 物料信息变化表.Code=物料信息表.Code and 物料信息表.TypeId=物料类型信息表.ID ORDER BY 物料信息变化表.ID"
  413.  D1.Refresh
  414.  grid.ColWidth(0) = 300
  415.  rec.MoveLast
  416.  TotalRecord = rec.RecordCount
  417.  rec.MoveFirst
  418.  sbr.Panels(1).Text = " 共 :" & TotalRecord & "条记录"
  419. End Sub
  420. Private Sub grid_Click()
  421. If grid.Row = 0 Then Exit Sub
  422.  txtCode.Text = grid.TextMatrix(grid.Row, 1)
  423.  txtName.Text = grid.TextMatrix(grid.Row, 2)
  424.  txtLast.Text = grid.TextMatrix(grid.Row, 3)
  425.  txtToday.Text = grid.TextMatrix(grid.Row, 4)
  426.  txtVol.Text = grid.TextMatrix(grid.Row, 5)
  427.  txtVolPrice.Text = grid.TextMatrix(grid.Row, 6)
  428.  txtChange.Text = grid.TextMatrix(grid.Row, 7)
  429.  txtInventory.Text = grid.TextMatrix(grid.Row, 9)
  430.  txtDate.Text = grid.TextMatrix(grid.Row, 10)
  431.   
  432.  AllDisEnabled
  433.  comDate.Enabled = False
  434.  If grid.TextMatrix(grid.Row, 8) = "甲等" Then
  435.     Combo1.ListIndex = 0
  436.  Else
  437.     Combo1.ListIndex = 1
  438.  End If
  439.  
  440.  
  441.  Tlbar.Buttons(3).Enabled = True
  442.  Tlbar.Buttons(5).Enabled = False
  443.  Combo1.Enabled = False
  444. End Sub
  445. Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
  446.   txtDate.Text = MonthView1.Value
  447.   MonthView1.Visible = False
  448. End Sub
  449. Private Sub Tlbar_ButtonClick(ByVal Button As MSComctlLib.Button)
  450.  
  451.  Select Case Button.key
  452.    Case "Add"
  453.     add
  454.    Case "Save"
  455.     save
  456.    Case "Del"
  457.      If txtCode.Text = "" Then Exit Sub
  458.       r = MsgBox("确定要删除【" & txtName.Text & "】?(Y/N)", vbQuestion + vbOKCancel + vbDefaultButton1, "自动配料系统")
  459.          If r = 1 Then
  460.                                      
  461.               dbs.Execute "DELETE * FROM " & " [物料信息变化表] WHERE Code='" & grid.TextMatrix(grid.Row, 2) & "'"
  462.        
  463.        D1.Refresh
  464.        add
  465.        
  466.        If Not D1.Recordset.EOF Then
  467.           D1.Recordset.MoveLast
  468.        End If
  469.        
  470.        TotalRecord = D1.Recordset.RecordCount
  471.        sbr.Panels(1).Text = " 共 :" & TotalRecord & "条记录。"
  472.      End If
  473.      Clear
  474.   
  475.   Case "Edit"
  476.    Edit
  477.   Case "Exit"
  478.    Unload Me
  479.    dbs.Close
  480.    
  481.  End Select
  482. End Sub
  483. Private Sub add()
  484.  AllEnabled
  485.  AllClear
  486.  comDate.Enabled = True
  487.  txtCode.SetFocus
  488.  xg = False
  489.  Tlbar.Buttons(5).Enabled = True
  490.  Combo1.Enabled = True
  491. End Sub
  492. Private Sub save()
  493. D1.DatabaseName = filename
  494. Set rec = dbs.OpenRecordset("物料信息变化表")
  495. Set rec1 = dbs.OpenRecordset("物料信息表")
  496.   If Trim(txtCode.Text) = "" Or Trim(txtLast.Text) = "" Or Trim(txtName.Text) = "" & _
  497.                    "" Or Trim(txtToday.Text) = "" & _
  498.                    "" Or Trim(txtVolPrice.Text) = "" Or Trim(txtDate.Text) = "" Or Val(txtDate.Text) < #1/1/100# Or Val(txtDate.Text) > #12/31/9999# Then
  499.       r = MsgBox("数据非法,不能保存!", 0 + 16, "自动配料系统")
  500.       Exit Sub
  501.   End If
  502.   
  503.   
  504.   If xg = False Then
  505.      rec.AddNew
  506.      rec.Fields("Code") = txtCode.Text
  507.      rec.Fields("Last") = Val(txtLast.Text)
  508.      rec.Fields("Volume") = Val(txtVol.Text)
  509.      rec.Fields("Today") = Val(txtToday.Text)
  510.      rec.Fields("Change") = Val(txtChange.Text)
  511.      rec.Fields("Volume Price") = Val(txtVolPrice.Text)
  512.      rec.Fields("Inventory") = Val(txtInventory.Text)
  513.      rec.Fields("Day") = txtDate.Text
  514.      rec.Update
  515.      
  516.      rec1.Index = "PrimaryKey"
  517.      rec1.Seek "=", txtCode.Text
  518.      If rec1.NoMatch Then
  519.         rec1.AddNew
  520.         rec1.Fields("Code") = txtCode.Text
  521.         rec1.Fields("Name") = txtName.Text
  522.         rec1.Fields("TypeId") = Combo1.ListIndex + 1
  523.         rec1.Update
  524.      End If
  525.      D1.Refresh
  526.       If Not D1.Recordset.EOF Then
  527.           D1.Recordset.MoveLast
  528.       End If
  529.     TotalRecord = D1.Recordset.RecordCount
  530.     sbr.Panels(1).Text = " 共 :" & TotalRecord & "条记录。"
  531.   
  532.    Else
  533.       rec.Index = "PrimaryKey"
  534.       rec.Seek "=", grid.TextMatrix(grid.Row, 0)
  535.       rec.Edit
  536.       rec.Fields("Code") = txtCode.Text
  537.       rec.Fields("Last") = Val(txtLast.Text)
  538.       rec.Fields("Volume") = Val(txtVol.Text)
  539.       rec.Fields("Today") = txtToday.Text
  540.       rec.Fields("Change") = Val(txtChange.Text)
  541.       rec.Fields("Volume Price") = Val(txtVolPrice.Text)
  542.       rec.Update
  543.      
  544.      rec1.Index = "PrimaryKey"
  545.      rec1.Seek "=", txtCode.Text
  546.      If Not rec1.NoMatch Then
  547.         rec1.Edit
  548.         rec1.Fields("Code") = txtCode.Text
  549.         rec1.Fields("Name") = txtName.Text
  550.         rec1.Fields("TypeId") = Combo1.ListIndex + 1
  551.         rec1.Update
  552.      End If
  553.      D1.Refresh
  554.    End If
  555.    Clear
  556. End Sub
  557. Private Sub txt_Change(Index As Integer)
  558.  Tlbar.Buttons(5).Enabled = True
  559. End Sub
  560. Private Sub Edit()
  561.  xg = True
  562.  AllEnabled
  563.  Tlbar.Buttons(5).Enabled = True
  564.  Combo1.Enabled = True
  565.  comDate.Enabled = True
  566. End Sub
  567. Private Sub Clear()
  568.  AllClear
  569.  AllDisEnabled
  570.  Tlbar.Buttons(3).Enabled = False
  571.  Tlbar.Buttons(5).Enabled = False
  572.  Combo1.Enabled = False
  573.  comDate.Enabled = False
  574. End Sub
  575. Private Sub AllClear()
  576.  txtCode.Text = ""
  577.  txtLast.Text = ""
  578.  txtName.Text = ""
  579.  txtVol.Text = ""
  580.  txtToday.Text = ""
  581.  txtChange.Text = ""
  582.  txtVolPrice.Text = ""
  583.  txtInventory.Text = ""
  584. End Sub
  585. Private Sub AllDisEnabled()
  586.  txtCode.Enabled = False
  587.  txtLast.Enabled = False
  588.  txtDate.Enabled = False
  589.  txtVol.Enabled = False
  590.  txtName.Enabled = False
  591.  txtToday.Enabled = False
  592.  txtChange.Enabled = False
  593.  txtVolPrice.Enabled = False
  594.  txtInventory.Enabled = False
  595. End Sub
  596. Private Sub AllEnabled()
  597.  txtCode.Enabled = True
  598.  txtLast.Enabled = True
  599.  txtDate.Enabled = True
  600.  txtName.Enabled = True
  601.  txtVol.Enabled = True
  602.  txtToday.Enabled = True
  603.  txtChange.Enabled = True
  604.  txtVolPrice.Enabled = True
  605.  txtInventory.Enabled = True
  606. End Sub
  607. Private Sub txtDate_LostFocus()
  608.     If Trim(txtDate.Text) = "" Then
  609.         MsgBox "请输入日期!", 48, "提示"
  610.         Text3.SetFocus
  611.     Else
  612.         If Not IsDate(txtDate.Text) Then
  613.             MsgBox "请输入日期型格式!", 48, "提示"
  614.             txtDate.SetFocus
  615.         Else
  616.             txtDate.Text = Format(txtDate.Text, "yyyy-mm-dd")
  617.         End If
  618.     End If
  619. End Sub