fixFixed2.frm
上传用户:cntx88
上传日期:2022-08-07
资源大小:169k
文件大小:9k
源码类别:

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
  3. Begin VB.Form fixFixed2 
  4.    Caption         =   "修改固定资产"
  5.    ClientHeight    =   6165
  6.    ClientLeft      =   60
  7.    ClientTop       =   450
  8.    ClientWidth     =   7140
  9.    LinkTopic       =   "Form1"
  10.    LockControls    =   -1  'True
  11.    ScaleHeight     =   6165
  12.    ScaleWidth      =   7140
  13.    StartUpPosition =   3  '窗口缺省
  14.    Begin VB.Frame Frame2 
  15.       Height          =   1095
  16.       Left            =   120
  17.       TabIndex        =   17
  18.       Top             =   4800
  19.       Width           =   6855
  20.       Begin VB.CommandButton Command2 
  21.          Caption         =   "放弃修改"
  22.          Height          =   615
  23.          Left            =   3720
  24.          TabIndex        =   21
  25.          Top             =   240
  26.          Width           =   2895
  27.       End
  28.       Begin VB.CommandButton Command1 
  29.          Caption         =   "修改资产信息"
  30.          Default         =   -1  'True
  31.          Height          =   615
  32.          Left            =   240
  33.          TabIndex        =   20
  34.          Top             =   240
  35.          Width           =   2895
  36.       End
  37.    End
  38.    Begin VB.Frame Frame1 
  39.       Caption         =   "固定资产修改"
  40.       Height          =   4575
  41.       Left            =   120
  42.       TabIndex        =   0
  43.       Top             =   120
  44.       Width           =   6855
  45.       Begin VB.TextBox Text7 
  46.          Appearance      =   0  'Flat
  47.          Height          =   270
  48.          Left            =   2520
  49.          TabIndex        =   19
  50.          Text            =   "Text7"
  51.          Top             =   1440
  52.          Width           =   1815
  53.       End
  54.       Begin VB.TextBox Text6 
  55.          Appearance      =   0  'Flat
  56.          Height          =   1335
  57.          Left            =   240
  58.          MaxLength       =   100
  59.          MultiLine       =   -1  'True
  60.          TabIndex        =   15
  61.          Text            =   "fixFixed2.frx":0000
  62.          Top             =   3000
  63.          Width           =   6375
  64.       End
  65.       Begin VB.TextBox Text5 
  66.          Appearance      =   0  'Flat
  67.          Height          =   270
  68.          Left            =   4800
  69.          TabIndex        =   13
  70.          Text            =   "Text5"
  71.          Top             =   1440
  72.          Width           =   1815
  73.       End
  74.       Begin MSComCtl2.DTPicker DTPicker1 
  75.          Height          =   255
  76.          Left            =   2520
  77.          TabIndex        =   11
  78.          Top             =   2280
  79.          Width           =   1815
  80.          _ExtentX        =   3201
  81.          _ExtentY        =   450
  82.          _Version        =   393216
  83.          Format          =   27000833
  84.          CurrentDate     =   38012
  85.       End
  86.       Begin VB.ComboBox PartCombo 
  87.          Height          =   300
  88.          Left            =   240
  89.          TabIndex        =   10
  90.          Text            =   "Combo1"
  91.          Top             =   2280
  92.          Width           =   1815
  93.       End
  94.       Begin VB.TextBox Text4 
  95.          Appearance      =   0  'Flat
  96.          Height          =   270
  97.          Left            =   240
  98.          TabIndex        =   7
  99.          Text            =   "Text4"
  100.          Top             =   1440
  101.          Width           =   1815
  102.       End
  103.       Begin VB.TextBox Text3 
  104.          Appearance      =   0  'Flat
  105.          Height          =   270
  106.          Left            =   4800
  107.          TabIndex        =   6
  108.          Text            =   "Text3"
  109.          Top             =   600
  110.          Width           =   1815
  111.       End
  112.       Begin VB.TextBox Text2 
  113.          Appearance      =   0  'Flat
  114.          Height          =   270
  115.          Left            =   2520
  116.          TabIndex        =   4
  117.          Text            =   "Text2"
  118.          Top             =   600
  119.          Width           =   1815
  120.       End
  121.       Begin VB.TextBox Text1 
  122.          Appearance      =   0  'Flat
  123.          Enabled         =   0   'False
  124.          Height          =   270
  125.          Left            =   240
  126.          TabIndex        =   1
  127.          Text            =   "Text1"
  128.          Top             =   600
  129.          Width           =   1815
  130.       End
  131.       Begin VB.Label Label9 
  132.          Caption         =   "经手人ID"
  133.          Height          =   255
  134.          Left            =   2520
  135.          TabIndex        =   18
  136.          Top             =   1200
  137.          Width           =   1335
  138.       End
  139.       Begin VB.Label Label8 
  140.          Caption         =   "资产说明"
  141.          Height          =   255
  142.          Left            =   240
  143.          TabIndex        =   16
  144.          Top             =   2760
  145.          Width           =   2055
  146.       End
  147.       Begin VB.Label Label7 
  148.          Caption         =   "联系电话"
  149.          Height          =   255
  150.          Left            =   4800
  151.          TabIndex        =   14
  152.          Top             =   1200
  153.          Width           =   1455
  154.       End
  155.       Begin VB.Label Label6 
  156.          Caption         =   "购买日期"
  157.          Height          =   255
  158.          Left            =   2520
  159.          TabIndex        =   12
  160.          Top             =   2040
  161.          Width           =   1455
  162.       End
  163.       Begin VB.Label Label5 
  164.          Caption         =   "购买部门"
  165.          Height          =   255
  166.          Left            =   240
  167.          TabIndex        =   9
  168.          Top             =   2040
  169.          Width           =   1215
  170.       End
  171.       Begin VB.Label Label4 
  172.          Caption         =   "单价(元)"
  173.          Height          =   255
  174.          Left            =   240
  175.          TabIndex        =   8
  176.          Top             =   1200
  177.          Width           =   1335
  178.       End
  179.       Begin VB.Label Label3 
  180.          Caption         =   "资产数目"
  181.          Height          =   255
  182.          Left            =   4800
  183.          TabIndex        =   5
  184.          Top             =   360
  185.          Width           =   1335
  186.       End
  187.       Begin VB.Label Label2 
  188.          Caption         =   "资产名称"
  189.          Height          =   255
  190.          Left            =   2520
  191.          TabIndex        =   3
  192.          Top             =   360
  193.          Width           =   1575
  194.       End
  195.       Begin VB.Label Label1 
  196.          Caption         =   "资产编号"
  197.          Height          =   255
  198.          Left            =   240
  199.          TabIndex        =   2
  200.          Top             =   360
  201.          Width           =   1575
  202.       End
  203.    End
  204. End
  205. Attribute VB_Name = "fixFixed2"
  206. Attribute VB_GlobalNameSpace = False
  207. Attribute VB_Creatable = False
  208. Attribute VB_PredeclaredId = True
  209. Attribute VB_Exposed = False
  210. Private Sub Command1_Click()
  211.     Dim sql As String
  212.     Dim rs As New ADODB.Recordset
  213.     
  214.     If Text1.Text = "" Then     '检查输入数据是否有效以及输入是否完整
  215.         MsgBox "资产编号不能为空!", vbCritical
  216.         Text1.SetFocus
  217.         Exit Sub
  218.     End If
  219.     If Text2.Text = "" Then
  220.         MsgBox "资产名称不能为空!", vbCritical
  221.         Text2.SetFocus
  222.         Exit Sub
  223.     End If
  224.     If Text3.Text = "" Then
  225.         MsgBox "资产数目不能为空!", vbCritical
  226.         Text3.SetFocus
  227.         Exit Sub
  228.     End If
  229.     If Text4.Text = "" Then
  230.         MsgBox "资产单价不能为空!", vbCritical
  231.         Text4.SetFocus
  232.         Exit Sub
  233.     End If
  234.     If Text7.Text = "" Then
  235.         MsgBox "经手人ID不能为空!", vbCritical
  236.         Text7.SetFocus
  237.         Exit Sub
  238.     End If
  239.     If Text5.Text = "" Then
  240.         MsgBox "联系电话不能为空!", vbCritical
  241.         Text5.SetFocus
  242.         Exit Sub
  243.     End If
  244.     If Text6.Text = "" Then
  245.         MsgBox "资产说明不能为空!", vbCritical
  246.         Text6.SetFocus
  247.         Exit Sub
  248.     End If
  249.     If Not IsNumeric(Text3.Text) Then
  250.         MsgBox "资产数目必须是数字!", vbCritical
  251.         Text3.SetFocus
  252.         Exit Sub
  253.     End If
  254.     If Not IsNumeric(Text4.Text) Then
  255.         MsgBox "资产单价必须是数字!", vbCritical
  256.         Text4.SetFocus
  257.         Exit Sub
  258.     End If
  259.     If PartCombo.ListIndex = -1 Then
  260.         MsgBox "部门必须选择!", vbCritical
  261.         PartCombo.SetFocus
  262.         Exit Sub
  263.     End If
  264.     
  265.     If DbHandle.DbConnection Then
  266.         sql = "TBL_USER"        '打开职工表,查询输入的职工ID是否存在
  267.         rs.CursorType = adOpenDynamic
  268.         rs.LockType = adLockOptimistic
  269.         rs.Filter = "USER_ID='" & Text7.Text & "'"
  270.         rs.Open sql, DbFinance
  271.         If DbHandle.resultcount(rs) <> 1 Then       '不存在要求用户重新输入职工ID号
  272.             MsgBox "错误,不存在的ID号!", vbExclamation
  273.             Text7.SetFocus
  274.             rs.Close
  275.             Set rs = Nothing
  276.             DbHandle.DbClose
  277.             Exit Sub
  278.         End If
  279.         rs.Close
  280.         sql = "TBL_FIXED"
  281.         rs.CursorType = adOpenDynamic
  282.         rs.LockType = adLockOptimistic
  283.         rs.Filter = "FIXED_ID='" & Text1.Text & "'"
  284.         rs.Open sql, DbFinance '如果职工存在,定位固定资产表中的记录,修改记录属性值
  285.         rs("FIXED_NAME") = Text2.Text
  286.         rs("FIXED_NUM") = Val(Text3.Text)
  287.         rs("FIXED_MONEY") = Val(Text4.Text)
  288.         rs("FIXED_PART") = PartCombo.ItemData(PartCombo.ListIndex)
  289.         rs("FIXED_USER") = Text7.Text
  290.         rs("FIXED_PHONE") = Text5.Text
  291.         rs("FIXED_DATE") = DTPicker1.Value
  292.         rs("FIXED_REMARK") = Text6.Text
  293.         rs.Update
  294.         rs.Close        '释放资源,提示修改成功,返回主窗体
  295.         MsgBox "固定资产信息成功修改!"
  296.         Unload Me
  297.     Else        '数据库连接出错,退出
  298.         MsgBox "数据库错误!", vbExclamation
  299.         DbHandle.DbClose
  300.         End
  301.     End If
  302. End Sub
  303. Private Sub Command2_Click()
  304.     Unload Me       '返回主窗体
  305. End Sub