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

📄 技术人才信息录入.frm

📁 本程序是用Visual Basic来建立数据库管理系统的经典例程。
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Height          =   210
      Left            =   360
      TabIndex        =   26
      Top             =   2805
      Width           =   1470
   End
   Begin VB.Label Label23 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "技术人才信息录入"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   24
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   480
      Left            =   3930
      TabIndex        =   25
      Top             =   -30
      Width           =   3840
   End
   Begin VB.Label Label33 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "号"
      Height          =   210
      Left            =   8610
      TabIndex        =   24
      Top             =   2130
      Width           =   210
   End
   Begin VB.Label Label32 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "街(路)"
      Height          =   210
      Left            =   6600
      TabIndex        =   22
      Top             =   2130
      Width           =   840
   End
   Begin VB.Label Label31 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "区(镇)"
      Height          =   210
      Left            =   4680
      TabIndex        =   20
      Top             =   2130
      Width           =   840
   End
   Begin VB.Label Label30 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "市(县)"
      Height          =   210
      Left            =   2820
      TabIndex        =   18
      Top             =   2130
      Width           =   840
   End
   Begin VB.Label Label7 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "出生日期:"
      Height          =   210
      Left            =   4950
      TabIndex        =   17
      Top             =   750
      Width           =   1050
   End
   Begin VB.Label lable25 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "年"
      Height          =   210
      Left            =   7410
      TabIndex        =   16
      Top             =   750
      Width           =   210
   End
   Begin VB.Label Label25 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "月"
      Height          =   210
      Left            =   8610
      TabIndex        =   15
      Top             =   750
      Width           =   210
   End
   Begin VB.Label Label26 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "日"
      Height          =   210
      Left            =   9630
      TabIndex        =   14
      Top             =   750
      Width           =   210
   End
   Begin VB.Line Line1 
      BorderColor     =   &H00FFFFFF&
      BorderWidth     =   2
      X1              =   0
      X2              =   1027
      Y1              =   36
      Y2              =   36
   End
   Begin VB.Label Label8 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "政治面貌:"
      Height          =   210
      Left            =   3930
      TabIndex        =   5
      Top             =   1455
      Width           =   1050
   End
   Begin VB.Label Label6 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "技术职称:"
      Height          =   210
      Left            =   7500
      TabIndex        =   4
      Top             =   1455
      Width           =   1140
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "通讯地址:"
      Height          =   210
      Left            =   360
      TabIndex        =   3
      Top             =   2130
      Width           =   1050
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "文化程度:"
      Height          =   210
      Left            =   360
      TabIndex        =   2
      Top             =   1455
      Width           =   1050
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "性别:"
      Height          =   210
      Left            =   2670
      TabIndex        =   1
      Top             =   750
      Width           =   630
   End
End
Attribute VB_Name = "技术人才信息录入"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Num As Integer
Private Sub Form_Load()
On Error GoTo A1
Dim A As String
Dim B As Integer
    A = Me.hwnd
    B = 0
    Disabled A, B
    Me.Left = 0: Me.Top = 0
    Data1.DatabaseName = App.Path + "\" + "人才库.mdb"
    Data1.Refresh
    Data1.Recordset.MoveLast
    Num = Data1.Recordset.RecordCount
    StatusBar1.Panels(1).Text = "原有记录总数: " & Num
    StatusBar1.Panels(2).Text = "现新增第 " & Num + 1 & " 条记录"
    StatusBar1.Panels(3).Text = "今天日期: " & Format(Date, "yyyy 年 m 月 d 日")
    StatusBar1.Panels(4).Text = "当前时间: " & Time
    Data1.Recordset.AddNew
A1:
   Data1.Recordset.AddNew
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
  If Text1 = "" Then
    MsgBox "      请输入姓名   "
    Text1.SetFocus
  Else
  Option1.Enabled = True: Option2.Enabled = True
End If
End If
End Sub
Private Sub Option1_Click()
Text12 = "男"
Text2.Enabled = True: Text2.SetFocus
Text2.BackColor = &H80000005
End Sub
Private Sub Option2_Click()
Text12 = "女"
Text2.Enabled = True: Text2.SetFocus
Text2.BackColor = &H80000005
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
  If IsNumeric(Text2) = False Then
   MsgBox "请输入数据  !", vbExclamation
    Text2 = "": Text2.SetFocus
   Else
    Text3.Enabled = True: Text3.SetFocus
    Text3.BackColor = &H80000005
  End If
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If IsNumeric(Text3) = False Then
  MsgBox "请输入数据  !", vbExclamation
    Text3 = "": Text3.SetFocus
  Else
    If Val(Text3) < 1 Or Val(Text3) > 12 Then
     MsgBox "月份不能小于 1 或大于 12,请重新输入 !"
      Text3 = "": Text3.SetFocus
    Else
   Text4.Enabled = True: Text4.SetFocus
   Text4.BackColor = &H80000005
   End If
 End If
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If IsNumeric(Text4) = False Then
  MsgBox "请输入数据"
    Text4 = "": Text4.SetFocus
  Else
    If Val(Text4) < 1 Or Val(Text4) > 31 Then
     MsgBox "日期不能小于 1 或大于 31,请重新输入 !"
      Text4 = "": Text4.SetFocus
    Else
     Combo1 = ""
     Combo1.Enabled = True: Combo1.SetFocus
     Combo1.BackColor = &H80000005
   End If
 End If
End If
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Combo2 = "": Combo2.Enabled = True: Combo2.SetFocus
Combo2.BackColor = &H80000005
End If
End Sub
Private Sub Combo2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Combo3.Text = "": Combo3.Enabled = True: Combo3.SetFocus
Combo3.BackColor = &H80000005
End If
End Sub
Private Sub Combo3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text5.Enabled = True: Text5.SetFocus
Text5.BackColor = &H80000005
End If
End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text6.Enabled = True: Text6.SetFocus
Text6.BackColor = &H80000005
End If
End Sub
Private Sub Text6_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text7.Enabled = True: Text7.SetFocus
Text7.BackColor = &H80000005
End If
End Sub
Private Sub Text7_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text8.Enabled = True: Text8.SetFocus
Text8.BackColor = &H80000005
End If
End Sub
Private Sub Text8_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text9.Enabled = True: Text9.SetFocus
Text9.BackColor = &H80000005
End If
End Sub
Private Sub Text9_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text10.Enabled = True: Text10.SetFocus
Text10.BackColor = &H80000005
End If
End Sub
Private Sub Text10_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text11.Enabled = True: Text11.SetFocus
Text11.BackColor = &H80000005
Command1.SetFocus
End If
End Sub
Private Sub Text11_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub
Private Sub Command1_Click()
If Text1 = "" Then
  MsgBox "姓名不能为空,请输入姓名 !"
  Text1 = ""
  Text1.SetFocus
 Else
    Text1.SetFocus
    Data1.Recordset.MoveLast
    Num = Data1.Recordset.RecordCount
    StatusBar1.Panels(1).Text = "原有记录总数: " & Num
    StatusBar1.Panels(2).Text = "现新增第 " & Num + 1 & " 条记录"
Data1.Recordset.AddNew
Clear
End If
End Sub
Private Sub Command1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
 If Text1 = "" Then
  MsgBox "姓名不能为空,请输入姓名 !", vbExclamation
  Text1 = ""
  Text1.SetFocus
 Else
    Text1.SetFocus
    Data1.Recordset.MoveLast
    Num = Data1.Recordset.RecordCount
    StatusBar1.Panels(1).Text = "原有记录总数: " & Num
    StatusBar1.Panels(2).Text = "现新增第 " & Num + 1 & " 条记录"
    Data1.Recordset.AddNew
    Clear
   End If
 End If
End Sub
Private Sub Command2_Click()
Text1.SetFocus
Clear
End Sub
Private Sub Command3_Click()
If Text1 = "" Then
  MsgBox "姓名不能为空,请输入姓名 !", vbExclamation
  Text1.SetFocus
 Else
    Data1.Recordset.Update
    Data1.Recordset.Close
    Unload Me
    技术人才主菜单.Show
End If
End Sub
Private Sub Command4_Click()
On Error Resume Next
Data1.Recordset.Delete
Unload Me
技术人才主菜单.Show
End Sub
Private Sub Clear()
Combo1 = "": Combo2 = "": Combo3 = ""
Option1.Enabled = False: Option2.Enabled = False
Combo1.BackColor = &H80000001: Combo2.BackColor = &H80000001: Combo3.BackColor = &H80000001
Combo1.Enabled = False: Combo2.Enabled = False: Combo3.Enabled = False
Text1 = "": Text2 = "": Text3 = "": Text4 = "": Text5 = ""
Text6 = "": Text7 = "": Text8 = "": Text9 = "": Text10 = "": Text11 = ""
Text2.Enabled = False: Text3.Enabled = False: Text4.Enabled = False
Text5.Enabled = False: Text6.Enabled = False: Text7.Enabled = False
Text8.Enabled = False: Text9.Enabled = False: Text10.Enabled = False
Text11.Enabled = False
Text2.BackColor = &H80000001: Text3.BackColor = &H80000001: Text4.BackColor = &H80000001
Text5.BackColor = &H80000001: Text6.BackColor = &H80000001: Text7.BackColor = &H80000001
Text8.BackColor = &H80000001: Text9.BackColor = &H80000001: Text10.BackColor = &H80000001
Text11.BackColor = &H80000001
End Sub
Private Sub Timer1_Timer()
 StatusBar1.Panels(4).Text = "当前时间: " & Time
End Sub

⌨️ 快捷键说明

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