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

其他行业

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Begin VB.Form frmsearch 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "信息查询"
  5.    ClientHeight    =   2595
  6.    ClientLeft      =   5730
  7.    ClientTop       =   2160
  8.    ClientWidth     =   4230
  9.    LinkTopic       =   "Form2"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   2595
  13.    ScaleWidth      =   4230
  14.    StartUpPosition =   1  '所有者中心
  15.    Begin VB.CommandButton cmdcancel 
  16.       Caption         =   "取消"
  17.       Height          =   375
  18.       Left            =   2392
  19.       TabIndex        =   5
  20.       Top             =   1995
  21.       Width           =   1095
  22.    End
  23.    Begin VB.CommandButton cmdsearch 
  24.       Caption         =   "查询"
  25.       Height          =   375
  26.       Left            =   817
  27.       TabIndex        =   4
  28.       Top             =   1995
  29.       Width           =   1095
  30.    End
  31.    Begin VB.TextBox Text1 
  32.       Appearance      =   0  'Flat
  33.       Height          =   270
  34.       Index           =   1
  35.       Left            =   1890
  36.       TabIndex        =   3
  37.       Top             =   1260
  38.       Width           =   1095
  39.    End
  40.    Begin VB.TextBox Text1 
  41.       Appearance      =   0  'Flat
  42.       Height          =   270
  43.       Index           =   0
  44.       Left            =   1890
  45.       TabIndex        =   2
  46.       Top             =   630
  47.       Width           =   1095
  48.    End
  49.    Begin VB.OptionButton Option1 
  50.       Caption         =   "按ID"
  51.       Height          =   270
  52.       Index           =   1
  53.       Left            =   945
  54.       TabIndex        =   1
  55.       Top             =   1260
  56.       Width           =   855
  57.    End
  58.    Begin VB.OptionButton Option1 
  59.       Caption         =   "按姓名"
  60.       Height          =   270
  61.       Index           =   0
  62.       Left            =   945
  63.       TabIndex        =   0
  64.       Top             =   630
  65.       Width           =   855
  66.    End
  67.    Begin VB.Frame Frame1 
  68.       Caption         =   "查询"
  69.       Height          =   1650
  70.       Left            =   420
  71.       TabIndex        =   6
  72.       Top             =   210
  73.       Width           =   3345
  74.    End
  75.    Begin VB.Data Data1 
  76.       Caption         =   "Data1"
  77.       Connect         =   "Access"
  78.       DatabaseName    =   "G:大学人事管理人事管理reshi.mdb"
  79.       DefaultCursorType=   0  '缺省游标
  80.       DefaultType     =   2  '使用 ODBC
  81.       Exclusive       =   0   'False
  82.       Height          =   375
  83.       Left            =   210
  84.       Options         =   0
  85.       ReadOnly        =   0   'False
  86.       RecordsetType   =   0  'Table
  87.       RecordSource    =   "reshi"
  88.       Top             =   2520
  89.       Width           =   2355
  90.    End
  91.    Begin VB.Image Image1 
  92.       BorderStyle     =   1  'Fixed Single
  93.       DataField       =   "photo"
  94.       DataSource      =   "Data1"
  95.       Height          =   645
  96.       Left            =   4200
  97.       Stretch         =   -1  'True
  98.       Top             =   2415
  99.       Width           =   645
  100.    End
  101. End
  102. Attribute VB_Name = "frmsearch"
  103. Attribute VB_GlobalNameSpace = False
  104. Attribute VB_Creatable = False
  105. Attribute VB_PredeclaredId = True
  106. Attribute VB_Exposed = False
  107. Option Explicit
  108.  Sub cmdsearch_Click()
  109.  Dim j As Integer
  110. Data1.Refresh
  111. Data1.Recordset.MoveFirst
  112. For I = 0 To Data1.Recordset.RecordCount - 1
  113. If Option1(0).Enabled = True Then
  114.  If Trim(Text1(0).Text) = Left(Data1.Recordset.Fields("name"), 1) Or Trim(Text1(0).Text) = Left(Data1.Recordset.Fields("name"), 2) Or Trim(Text1(0).Text) = Left(Data1.Recordset.Fields("name"), 3) Or Trim(Text1(0).Text) = Right(Data1.Recordset.Fields("name"), 1) Or Trim(Text1(0).Text) = Right(Data1.Recordset.Fields("name"), 2) Or Trim(Text1(0).Text) = Mid(Data1.Recordset.Fields("name"), 2, 1) Then
  115.  'if Trim(Text1(1).Text) = Trim(Data1.Recordset.Fields("ID")) Then
  116.    
  117.        If Data1.Recordset.Fields("flag") = Val(1) Then
  118.         With frmshow1
  119.                 .Text1(0).Text = Data1.Recordset.Fields("name")
  120.                 .Text1(1).Text = Data1.Recordset.Fields("ID")
  121.                 .Text1(2).Text = Data1.Recordset.Fields("profession")
  122.                 .Text1(3).Text = Data1.Recordset.Fields("sex")
  123.                 .Text1(5).Text = Data1.Recordset.Fields("location")
  124.                 .Text1(4).Text = Data1.Recordset.Fields("age")
  125.                 .Text1(6).Text = Data1.Recordset.Fields("phone")
  126.                 .Text1(7).Text = Data1.Recordset.Fields("zip")
  127.                 .Text1(8).Text = Data1.Recordset.Fields("height")
  128.                 .Text1(9).Text = Data1.Recordset.Fields("weight")
  129.                 .Text1(10).Text = Data1.Recordset.Fields("address")
  130.                 .Text1(11).Text = Data1.Recordset.Fields("email")
  131.                 .Text1(12).Text = Data1.Recordset.Fields("remark")
  132.                 .Image1.Picture = Image1.Picture
  133.                 .Enabled = True
  134.                 .Visible = True
  135.         End With
  136.         For j = 0 To 13
  137.            frmshow1.Text1(j).Enabled = False
  138.         Next j
  139.         Exit Sub
  140.        End If
  141.      If Data1.Recordset.Fields("flag") = 0 Then
  142.        With frmshow0
  143.                 .Text1(0).Text = Data1.Recordset.Fields("name")
  144.                 .Text1(1).Text = Data1.Recordset.Fields("ID")
  145.                 .Text1(2).Text = Data1.Recordset.Fields("profession")
  146.                 .Text1(3).Text = Data1.Recordset.Fields("sex")
  147.                 .Text1(4).Text = Data1.Recordset.Fields("age")
  148.                 .Text1(5).Text = Data1.Recordset.Fields("marriage")
  149.                 .Text1(6).Text = Data1.Recordset.Fields("phone")
  150.                 .Text1(7).Text = Data1.Recordset.Fields("zip")
  151.                 .Text1(8).Text = Data1.Recordset.Fields("worktime")
  152.                 .Text1(10).Text = Data1.Recordset.Fields("address")
  153.                 .Text1(11).Text = Data1.Recordset.Fields("email")
  154.                 .Text1(9).Text = Data1.Recordset.Fields("remark")
  155.                 .Image1.Picture = Image1.Picture
  156.                 .Enabled = True
  157.                 .Visible = True
  158.       End With
  159.       For j = 0 To 11
  160.          frmshow0.Text1(j).Enabled = False
  161.       Next j
  162.       Exit Sub
  163.      End If
  164.       
  165.     ' If Data1.Recordset.Fields("flag") = 2 Then
  166.     ' '''''''''''''''''''
  167.     ' End If
  168.    
  169.   Else
  170.   Data1.Recordset.MoveNext
  171.   End If
  172. End If
  173. Next
  174. ''''''''''''''''''''''''''''''''''''''''''''''''
  175. Data1.Recordset.MoveFirst
  176. For I = 0 To Data1.Recordset.RecordCount - 1
  177. If Option1(1).Enabled = True Then
  178.  If Trim(Text1(1).Text) = Trim(Data1.Recordset.Fields("ID")) Then
  179.       If Data1.Recordset.Fields("flag") = Val(1) Then
  180.         With frmshow1
  181.                 .Text1(0).Text = Data1.Recordset.Fields("name")
  182.                 .Text1(1).Text = Data1.Recordset.Fields("ID")
  183.                 .Text1(2).Text = Data1.Recordset.Fields("profession")
  184.                 .Text1(3).Text = Data1.Recordset.Fields("sex")
  185.                 .Text1(5).Text = Data1.Recordset.Fields("location")
  186.                 .Text1(4).Text = Data1.Recordset.Fields("age")
  187.                 .Text1(6).Text = Data1.Recordset.Fields("phone")
  188.                 .Text1(7).Text = Data1.Recordset.Fields("zip")
  189.                 .Text1(8).Text = Data1.Recordset.Fields("height")
  190.                 .Text1(9).Text = Data1.Recordset.Fields("weight")
  191.                 .Text1(10).Text = Data1.Recordset.Fields("address")
  192.                 .Text1(11).Text = Data1.Recordset.Fields("email")
  193.                 .Text1(12).Text = Data1.Recordset.Fields("remark")
  194.                 .Image1.Picture = Image1.Picture
  195.                 .Enabled = True
  196.                 .Visible = True
  197.         End With
  198.         For j = 0 To 13
  199.            frmshow1.Text1(j).Enabled = False
  200.         Next j
  201.         Exit Sub
  202.        End If
  203.      If Data1.Recordset.Fields("flag") = 0 Then
  204.        With frmshow0
  205.                 .Text1(0).Text = Data1.Recordset.Fields("name")
  206.                 .Text1(1).Text = Data1.Recordset.Fields("ID")
  207.                 .Text1(2).Text = Data1.Recordset.Fields("profession")
  208.                 .Text1(3).Text = Data1.Recordset.Fields("sex")
  209.                 .Text1(4).Text = Data1.Recordset.Fields("age")
  210.                 .Text1(5).Text = Data1.Recordset.Fields("marriage")
  211.                 .Text1(6).Text = Data1.Recordset.Fields("phone")
  212.                 .Text1(7).Text = Data1.Recordset.Fields("zip")
  213.                 .Text1(8).Text = Data1.Recordset.Fields("worktime")
  214.                 .Text1(10).Text = Data1.Recordset.Fields("address")
  215.                 .Text1(11).Text = Data1.Recordset.Fields("email")
  216.                 .Text1(9).Text = Data1.Recordset.Fields("remark")
  217.                 .Image1.Picture = Image1.Picture
  218.                 .Enabled = True
  219.                 .Visible = True
  220.       End With
  221.       For j = 0 To 11
  222.          frmshow0.Text1(j).Enabled = False
  223.       Next j
  224.       Exit Sub
  225.      End If
  226.       
  227.     ' If Data1.Recordset.Fields("flag") = 2 Then
  228.     ' '''''''''''''''''''
  229.     ' End If
  230.    
  231.   Else
  232.   Data1.Recordset.MoveNext
  233.   End If
  234. End If
  235. Next
  236. End Sub
  237. Private Sub cmdcancel_Click()
  238. Unload Me
  239. frmmain.Enabled = True
  240. frmmain.Visible = True
  241. frmmain.SetFocus
  242. End Sub
  243. Private Sub Form_Load()
  244. Image1.Visible = False
  245. Data1.Visible = False
  246. End Sub
  247. Private Sub Form_Unload(Cancel As Integer)
  248. frmmain.Enabled = True
  249. End Sub
  250. '使用控件数组
  251. Private Sub Option1_Click(Index As Integer)
  252. Dim I As Integer
  253. For I = 0 To 1
  254. frmsearch.Text1(I).Enabled = False
  255. frmsearch.Text1(I).Text = ""
  256. frmsearch.Text1(I).BackColor = &H80000002
  257. Next I
  258. frmsearch.Text1(Index).Enabled = True
  259. frmsearch.Text1(Index).SetFocus
  260. frmsearch.Text1(Index).BackColor = &H80000005
  261. End Sub
  262. Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
  263. If KeyAscii = 13 Then
  264. Call cmdsearch_Click
  265. End If
  266. End Sub