frmstudent.frm
上传用户:plkplk66
上传日期:2007-06-06
资源大小:686k
文件大小:12k
源码类别:

其他行业

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Begin VB.Form frmstudent 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "学生信息录入"
  5.    ClientHeight    =   7320
  6.    ClientLeft      =   5250
  7.    ClientTop       =   690
  8.    ClientWidth     =   6090
  9.    LinkTopic       =   "Form2"
  10.    MaxButton       =   0   'False
  11.    ScaleHeight     =   7320
  12.    ScaleWidth      =   6090
  13.    StartUpPosition =   2  '屏幕中心
  14.    Begin VB.CommandButton cmdcancel 
  15.       Caption         =   "取消"
  16.       Height          =   375
  17.       Left            =   3780
  18.       TabIndex        =   32
  19.       Top             =   6825
  20.       Width           =   975
  21.    End
  22.    Begin VB.CommandButton cmdok 
  23.       Caption         =   "确定"
  24.       Height          =   375
  25.       Left            =   1470
  26.       TabIndex        =   28
  27.       Top             =   6825
  28.       Width           =   975
  29.    End
  30.    Begin VB.Frame Frame1 
  31.       Caption         =   "个人信息"
  32.       Height          =   6495
  33.       Left            =   240
  34.       TabIndex        =   0
  35.       Top             =   240
  36.       Width           =   5520
  37.       Begin VB.TextBox txtage 
  38.          Appearance      =   0  'Flat
  39.          Height          =   270
  40.          Left            =   2415
  41.          TabIndex        =   30
  42.          Top             =   1920
  43.          Width           =   645
  44.       End
  45.       Begin VB.Frame Frame3 
  46.          Caption         =   "备注"
  47.          Height          =   1455
  48.          Left            =   240
  49.          TabIndex        =   26
  50.          Top             =   4800
  51.          Width           =   5055
  52.          Begin VB.TextBox txtremark 
  53.             Appearance      =   0  'Flat
  54.             Height          =   1095
  55.             Left            =   120
  56.             MultiLine       =   -1  'True
  57.             ScrollBars      =   2  'Vertical
  58.             TabIndex        =   27
  59.             Top             =   240
  60.             Width           =   4710
  61.          End
  62.       End
  63.       Begin VB.TextBox txtweight 
  64.          Appearance      =   0  'Flat
  65.          Height          =   270
  66.          Left            =   3600
  67.          TabIndex        =   24
  68.          Top             =   4320
  69.          Width           =   615
  70.       End
  71.       Begin VB.TextBox txtheight 
  72.          Appearance      =   0  'Flat
  73.          Height          =   270
  74.          Left            =   960
  75.          TabIndex        =   21
  76.          Top             =   4320
  77.          Width           =   615
  78.       End
  79.       Begin VB.TextBox txtpostcode 
  80.          Appearance      =   0  'Flat
  81.          Height          =   270
  82.          Left            =   3735
  83.          TabIndex        =   19
  84.          Top             =   2880
  85.          Width           =   1320
  86.       End
  87.       Begin VB.TextBox txtdepartment 
  88.          Appearance      =   0  'Flat
  89.          Height          =   270
  90.          Left            =   960
  91.          TabIndex        =   17
  92.          Top             =   1440
  93.          Width           =   1335
  94.       End
  95.       Begin VB.TextBox txtID 
  96.          Appearance      =   0  'Flat
  97.          Height          =   270
  98.          Left            =   960
  99.          TabIndex        =   15
  100.          Top             =   960
  101.          Width           =   1335
  102.       End
  103.       Begin VB.ComboBox cmbcity 
  104.          Appearance      =   0  'Flat
  105.          Height          =   300
  106.          Left            =   1920
  107.          TabIndex        =   13
  108.          Text            =   "慈溪"
  109.          Top             =   2400
  110.          Width           =   735
  111.       End
  112.       Begin VB.ComboBox cmbprovince 
  113.          Appearance      =   0  'Flat
  114.          Height          =   300
  115.          Left            =   960
  116.          TabIndex        =   12
  117.          Text            =   "浙江"
  118.          Top             =   2400
  119.          Width           =   735
  120.       End
  121.       Begin VB.ComboBox cmbsex 
  122.          Appearance      =   0  'Flat
  123.          Height          =   300
  124.          Left            =   960
  125.          TabIndex        =   11
  126.          Text            =   "男"
  127.          Top             =   1920
  128.          Width           =   645
  129.       End
  130.       Begin VB.TextBox txtname 
  131.          Appearance      =   0  'Flat
  132.          Height          =   270
  133.          Left            =   960
  134.          TabIndex        =   4
  135.          Top             =   480
  136.          Width           =   1335
  137.       End
  138.       Begin VB.TextBox txtphone 
  139.          Appearance      =   0  'Flat
  140.          Height          =   270
  141.          Left            =   960
  142.          TabIndex        =   3
  143.          Top             =   2880
  144.          Width           =   1335
  145.       End
  146.       Begin VB.TextBox txtaddress 
  147.          Appearance      =   0  'Flat
  148.          Height          =   270
  149.          Left            =   960
  150.          TabIndex        =   2
  151.          Top             =   3360
  152.          Width           =   4095
  153.       End
  154.       Begin VB.TextBox txtemail 
  155.          Appearance      =   0  'Flat
  156.          Height          =   270
  157.          Left            =   960
  158.          TabIndex        =   1
  159.          Top             =   3840
  160.          Width           =   4095
  161.       End
  162.       Begin VB.Label Label16 
  163.          Caption         =   "点击此处添加照片"
  164.          Height          =   435
  165.          Left            =   3990
  166.          TabIndex        =   33
  167.          Top             =   1155
  168.          Width           =   750
  169.       End
  170.       Begin VB.Label Label15 
  171.          Caption         =   "岁"
  172.          Height          =   225
  173.          Left            =   3255
  174.          TabIndex        =   31
  175.          Top             =   1950
  176.          Width           =   225
  177.       End
  178.       Begin VB.Label Label14 
  179.          Caption         =   "年龄:"
  180.          Height          =   225
  181.          Left            =   1890
  182.          TabIndex        =   29
  183.          Top             =   1950
  184.          Width           =   540
  185.       End
  186.       Begin VB.Image Image1 
  187.          BorderStyle     =   1  'Fixed Single
  188.          Height          =   1695
  189.          Left            =   3675
  190.          Stretch         =   -1  'True
  191.          Top             =   525
  192.          Width           =   1380
  193.       End
  194.       Begin VB.Label Label13 
  195.          Caption         =   "kg"
  196.          Height          =   255
  197.          Left            =   4320
  198.          TabIndex        =   25
  199.          Top             =   4320
  200.          Width           =   255
  201.       End
  202.       Begin VB.Label Label12 
  203.          Caption         =   "体重:"
  204.          Height          =   255
  205.          Left            =   3000
  206.          TabIndex        =   23
  207.          Top             =   4320
  208.          Width           =   615
  209.       End
  210.       Begin VB.Label Label11 
  211.          Caption         =   "cm"
  212.          Height          =   255
  213.          Left            =   1680
  214.          TabIndex        =   22
  215.          Top             =   4320
  216.          Width           =   255
  217.       End
  218.       Begin VB.Label Label10 
  219.          Caption         =   "身高:"
  220.          Height          =   255
  221.          Left            =   240
  222.          TabIndex        =   20
  223.          Top             =   4320
  224.          Width           =   615
  225.       End
  226.       Begin VB.Label Label9 
  227.          Caption         =   "邮编:"
  228.          Height          =   255
  229.          Left            =   3045
  230.          TabIndex        =   18
  231.          Top             =   2880
  232.          Width           =   735
  233.       End
  234.       Begin VB.Label Label8 
  235.          Caption         =   "系别:"
  236.          Height          =   255
  237.          Left            =   240
  238.          TabIndex        =   16
  239.          Top             =   1440
  240.          Width           =   615
  241.       End
  242.       Begin VB.Label Label1 
  243.          Caption         =   "学号:"
  244.          Height          =   255
  245.          Left            =   240
  246.          TabIndex        =   14
  247.          Top             =   960
  248.          Width           =   615
  249.       End
  250.       Begin VB.Label Label7 
  251.          Caption         =   "E-MAIL:"
  252.          Height          =   255
  253.          Left            =   240
  254.          TabIndex        =   10
  255.          Top             =   3840
  256.          Width           =   735
  257.       End
  258.       Begin VB.Label Label6 
  259.          Caption         =   "地址:"
  260.          Height          =   255
  261.          Left            =   240
  262.          TabIndex        =   9
  263.          Top             =   3360
  264.          Width           =   615
  265.       End
  266.       Begin VB.Label Label5 
  267.          Caption         =   "电话:"
  268.          Height          =   255
  269.          Left            =   240
  270.          TabIndex        =   8
  271.          Top             =   2880
  272.          Width           =   615
  273.       End
  274.       Begin VB.Label Label4 
  275.          Caption         =   "籍贯:"
  276.          Height          =   255
  277.          Left            =   240
  278.          TabIndex        =   7
  279.          Top             =   2400
  280.          Width           =   735
  281.       End
  282.       Begin VB.Label Label3 
  283.          Caption         =   "性别:"
  284.          Height          =   255
  285.          Left            =   240
  286.          TabIndex        =   6
  287.          Top             =   1920
  288.          Width           =   615
  289.       End
  290.       Begin VB.Label Label2 
  291.          Caption         =   "姓名:"
  292.          Height          =   255
  293.          Left            =   240
  294.          TabIndex        =   5
  295.          Top             =   480
  296.          Width           =   615
  297.       End
  298.    End
  299.    Begin VB.Data Data1 
  300.       Caption         =   "Data1"
  301.       Connect         =   "Access"
  302.       DatabaseName    =   "G:大学人事管理reshi.mdb"
  303.       DefaultCursorType=   0  '缺省游标
  304.       DefaultType     =   2  '使用 ODBC
  305.       Exclusive       =   0   'False
  306.       Height          =   375
  307.       Left            =   2160
  308.       Options         =   0
  309.       ReadOnly        =   0   'False
  310.       RecordsetType   =   0  'Table
  311.       RecordSource    =   "reshi"
  312.       Top             =   3840
  313.       Width           =   3135
  314.    End
  315. End
  316. Attribute VB_Name = "frmstudent"
  317. Attribute VB_GlobalNameSpace = False
  318. Attribute VB_Creatable = False
  319. Attribute VB_PredeclaredId = True
  320. Attribute VB_Exposed = False
  321. Option Explicit
  322. Private Sub cmdcancel_Click()
  323. frmmain.Enabled = True
  324. frmmain.SetFocus
  325. Unload Me
  326. End Sub
  327. Private Sub cmdok_Click()
  328. Dim mark As Integer
  329. Dim k As Integer
  330. For k = 0 To Data1.Recordset.RecordCount - 1
  331. If txtname.Text = frmsearch.Data1.Recordset.Fields("name") Then
  332.     mark = MsgBox("记录已经存在,是否覆盖?", vbYesNoCancel)
  333.     If mark = 6 Then
  334.     GoTo fg
  335.     End If
  336.     If mark = 7 Then
  337.     Exit Sub
  338.     End If
  339.     If mark = 2 Then
  340.     Exit Sub
  341.     End If
  342. End If
  343. frmsearch.Data1.Recordset.MoveNext
  344. Next k
  345. fg:
  346. Set rs = db.OpenRecordset("SELECT * FROM reshi")
  347. If rs Is Nothing Or rs.Updatable = False Then
  348.    MsgBox "不能打开或写入记录集!"
  349.    Exit Sub
  350. End If
  351. rs.AddNew
  352. DataFile = 1
  353. Open FNAME For Binary Access Read As DataFile
  354. Fl = LOF(DataFile)
  355.  If Fl = 0 Then
  356.         Close DataFile
  357.         Exit Sub
  358.     End If
  359.         block = Fl  blocksize
  360.     Fragment = Fl Mod blocksize
  361.     ReDim Chunk(Fragment)
  362.     Get DataFile, , Chunk()
  363.     rs.Fields("photo").AppendChunk Chunk()
  364.     ReDim Chunk(blocksize)
  365.     For I = 1 To block
  366.         Get DataFile, , Chunk()
  367.         rs.Fields("photo").AppendChunk Chunk()
  368.     Next I
  369. Close DataFile
  370. rs.Fields("name") = txtname.Text
  371. rs.Fields("ID") = txtID.Text
  372. rs.Fields("profession") = txtdepartment.Text
  373. rs.Fields("zip") = txtpostcode.Text
  374. rs.Fields("phone") = txtphone.Text
  375. rs.Fields("sex") = cmbsex.Text
  376. rs.Fields("address") = txtaddress.Text
  377. rs.Fields("height") = Val(txtheight.Text)
  378. rs.Fields("weight") = Val(txtweight.Text)
  379. rs.Fields("location") = cmbprovince.Text + cmbcity.Text
  380. rs.Fields("remark") = txtremark.Text
  381. rs.Fields("email") = txtemail.Text
  382. rs.Fields("age") = Val(txtage.Text)
  383. rs.Fields("flag") = 1
  384. rs.Update
  385. rs.Close
  386. Set rs = Nothing
  387. MsgBox "信息已录入"
  388. End Sub
  389. Private Sub Form_Load()
  390. cmbsex.AddItem "男"
  391. cmbsex.AddItem "女"
  392. cmbprovince.AddItem "浙江"
  393. cmbcity.AddItem "慈溪"
  394. Set db = OpenDatabase("g:大学人事管理reshi.mdb")
  395. End Sub
  396. Private Sub Image1_Click()
  397. flag = 1
  398. frmloadpic.Visible = True
  399. frmloadpic.File1.Pattern = "*.bmp;*.jpg;*,ico;*.gif"
  400. Me.Enabled = False
  401. End Sub
  402. Private Sub Label16_Click()
  403. flag = 1
  404. frmloadpic.Visible = True
  405. frmloadpic.File1.Pattern = "*.bmp;*.jpg;*,ico;*.gif"
  406. Me.Enabled = False
  407. End Sub