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

📄 mainfrm.frm

📁 一个使用MDB的名片管理程序
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Width           =   735
      End
      Begin VB.Label Label9 
         Caption         =   "单位电话"
         Height          =   255
         Left            =   -71640
         TabIndex        =   10
         Top             =   600
         Width           =   735
      End
      Begin VB.Label Label11 
         Caption         =   "传呼号码"
         Height          =   255
         Left            =   -71640
         TabIndex        =   9
         Top             =   1200
         Width           =   735
      End
      Begin VB.Label Label13 
         Caption         =   "邮政编码"
         Height          =   615
         Left            =   -74280
         TabIndex        =   8
         Top             =   4560
         Width           =   1575
      End
      Begin VB.Label Label17 
         Caption         =   "OICQ号"
         Height          =   255
         Left            =   -71640
         TabIndex        =   7
         Top             =   1800
         Width           =   735
      End
      Begin VB.Label Label5 
         Caption         =   "民  族"
         Height          =   255
         Left            =   345
         TabIndex        =   6
         Top             =   2760
         Width           =   735
      End
      Begin VB.Label Label6 
         Caption         =   "血  型"
         Height          =   255
         Left            =   345
         TabIndex        =   5
         Top             =   3720
         Width           =   735
      End
      Begin VB.Label Label7 
         Caption         =   "网  名"
         Height          =   255
         Left            =   360
         TabIndex        =   4
         Top             =   3240
         Width           =   735
      End
      Begin VB.Label Label2 
         Caption         =   "性  别"
         Height          =   255
         Left            =   345
         TabIndex        =   3
         Top             =   1320
         Width           =   735
      End
      Begin VB.Label Label3 
         Caption         =   "年  龄"
         Height          =   255
         Left            =   345
         TabIndex        =   2
         Top             =   1800
         Width           =   735
      End
      Begin VB.Label Label4 
         Caption         =   "生  日"
         Height          =   255
         Left            =   345
         TabIndex        =   1
         Top             =   2280
         Width           =   735
      End
   End
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access 2000;"
      DatabaseName    =   "D:\My basic\003\dabase.mdb"
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   375
      Left            =   960
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   "Tabel"
      Top             =   7320
      Visible         =   0   'False
      Width           =   7575
   End
   Begin VB.Menu 文件 
      Caption         =   "文件(&F)"
   End
   Begin VB.Menu 编辑 
      Caption         =   "编辑(&E)"
      Begin VB.Menu 添加名片 
         Caption         =   "添加名片(&A)"
      End
      Begin VB.Menu 修改名片 
         Caption         =   "修改名片(&R)"
      End
      Begin VB.Menu 删除名片 
         Caption         =   "删除名片(&D)"
      End
   End
   Begin VB.Menu 视图 
      Caption         =   "视图(&V)"
      Begin VB.Menu 基本资料 
         Caption         =   "基本资料(&B)"
      End
      Begin VB.Menu 联络资料 
         Caption         =   "联络资料(&T)"
      End
      Begin VB.Menu 其它资料 
         Caption         =   "其它资料(&Q)"
      End
      Begin VB.Menu 总揽全局 
         Caption         =   "总揽全局(&A)"
      End
   End
   Begin VB.Menu 关于 
      Caption         =   "关于(&A)"
   End
   Begin VB.Menu 关闭 
      Caption         =   "关闭(&G)"
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Text1.Locked = False
Text2.Locked = False
Text3.Locked = False
Text4.Locked = False
Text5.Locked = False
Text6.Locked = False
Text7.Locked = False
Text8.Locked = False
Text9.Locked = False
Text10.Locked = False
Text11.Locked = False
Text12.Locked = False
Text13.Locked = False
Text14.Locked = False
Text15.Locked = False
Text16.Locked = False
Text17.Locked = False
Data1.Recordset.AddNew
Text1.SetFocus
End Sub

Private Sub Command2_Click()
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Text1.Locked = False
Text2.Locked = False
Text3.Locked = False
Text4.Locked = False
Text5.Locked = False
Text6.Locked = False
Text7.Locked = False
Text8.Locked = False
Text9.Locked = False
Text10.Locked = False
Text11.Locked = False
Text12.Locked = False
Text13.Locked = False
Text14.Locked = False
Text15.Locked = False
Text16.Locked = False
Text17.Locked = False
Data1.ReadOnly = False
End Sub

Private Sub Command3_Click()
If Data1.Recordset.RecordCount = 0 Then
Command5.Enabled = False
Command6.Enabled = False
MsgBox "已经没有数据可删除了!!!", , "错误!"
Exit Sub
End If
If MsgBox("您确定要删除当前案卷吗?", vbQuestion + vbYesNo, "提示") = vbYes Then
With Data1.Recordset
If Data1.Recordset.EOF Then
Command6.Enabled = False
Data1.Recordset.MoveLast
Exit Sub
End If
.Delete
.MoveNext
End With
End If
End Sub

Private Sub Command4_Click()
Data1.UpdateRecord
Data1.Recordset.Bookmark = Data1.Recordset.LastModified
Data1.Refresh
Text1.Locked = True
Text2.Locked = True
Text3.Locked = True
Text4.Locked = True
Text5.Locked = True
Text6.Locked = True
Text7.Locked = True
Text8.Locked = True
Text9.Locked = True
Text10.Locked = True
Text11.Locked = True
Text12.Locked = True
Text13.Locked = True
Text14.Locked = True
Text15.Locked = True
Text16.Locked = True
Text17.Locked = True
Data1.ReadOnly = True
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
End Sub

Private Sub Command7_Click()
On Error GoTo OOPS
Dim Inputstring As String
Inputstring = InputBox("请输入所需查询的姓名", "姓名输入提示")
If Len(Inputstring) > 0 Then
Data1.RecordSource = "SELECT * FROM Tabel WHERE " & "姓名" & " Like " & " '" & Inputstring & "'"
Data1.Refresh
Data1.Recordset.MoveLast: Data1.Recordset.MoveFirst
Data1.Refresh
End If
Exit Sub
OOPS:
MsgBox Err.Description
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = Chr(13) Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = Chr(13) Then
Text3.SetFocus
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = Chr(13) Then
Text4.SetFocus
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = Chr(13) Then
Text5.SetFocus
End If
End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = Chr(13) Then
Text6.SetFocus
End If
End Sub
Private Sub Text6_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = Chr(13) Then
Text7.SetFocus
End If
End Sub

Private Sub Text7_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = Chr(13) Then
Text8.SetFocus
End If
End Sub
Private Sub Text8_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = Chr(13) Then
Text9.SetFocus
End If
End Sub
Private Sub Text9_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = Chr(13) Then
Text10.SetFocus
End If
End Sub
Private Sub Text10_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = Chr(13) Then
Text11.SetFocus
End If
End Sub
Private Sub Text11_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = Chr(13) Then
Text12.SetFocus
End If
End Sub
Private Sub Text12_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = Chr(13) Then
Text13.SetFocus
End If
End Sub
Private Sub Text13_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = Chr(13) Then
Text14.SetFocus
End If
End Sub
Private Sub Text14_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = Chr(13) Then
Text15.SetFocus
End If
End Sub
Private Sub Text15_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = Chr(13) Then
Text16.SetFocus
End If
End Sub
Private Sub Text16_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = Chr(13) Then
Text17.SetFocus
End If
End Sub

Private Sub Command5_Click()
If Data1.Recordset.RecordCount = 0 Then
Command5.Enabled = False
Command6.Enabled = False
Else
Data1.Recordset.MoveNext
If Data1.Recordset.EOF Then
Data1.Recordset.MoveLast
Command5.Enabled = False
Else
Command5.Enabled = True
Command6.Enabled = True
End If
End If
End Sub

Private Sub Command6_Click()
If Data1.Recordset.RecordCount = 0 Then
Command5.Enabled = False
Command6.Enabled = False
Else
Data1.Recordset.MovePrevious
If Data1.Recordset.BOF Then
Data1.Recordset.MoveFirst
Command6.Enabled = False
Else
Command5.Enabled = True
Command6.Enabled = True
End If
End If
End Sub

Private Sub 关于_Click()

End Sub

Private Sub 基本资料_Click()
SSTab1.Tab = 0
End Sub

Private Sub 联络资料_Click()
SSTab1.Tab = 1
End Sub

Private Sub 其它资料_Click()
SSTab1.Tab = 2
End Sub

Private Sub 删除名片_Click()
If Data1.Recordset.RecordCount = 0 Then
Command1.Enabled = False
Command2.Enabled = False
MsgBox "已经没有数据可删除了!!!", , "错误!"
Exit Sub
End If
If MsgBox("您确定要删除当前案卷吗?", vbQuestion + vbYesNo, "提示") = vbYes Then
With Data1.Recordset
If Data1.Recordset.EOF Then
Command2.Enabled = False
Data1.Recordset.MoveLast
Exit Sub
End If
.Delete
.MoveNext
End With
End If
End Sub

Private Sub 添加名片_Click()
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Text1.Locked = False
Text2.Locked = False
Text3.Locked = False
Text4.Locked = False
Text5.Locked = False
Text6.Locked = False
Text7.Locked = False
Text8.Locked = False
Text9.Locked = False
Text10.Locked = False
Text11.Locked = False
Text12.Locked = False
Text13.Locked = False
Text14.Locked = False
Text15.Locked = False
Text16.Locked = False
Text17.Locked = False
Data1.Recordset.AddNew
Text1.SetFocus
End Sub

Private Sub 修改名片_Click()
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Text1.Locked = False
Text2.Locked = False
Text3.Locked = False
Text4.Locked = False
Text5.Locked = False
Text6.Locked = False
Text7.Locked = False
Text8.Locked = False
Text9.Locked = False
Text10.Locked = False
Text11.Locked = False
Text12.Locked = False
Text13.Locked = False
Text14.Locked = False
Text15.Locked = False
Text16.Locked = False
Text17.Locked = False
Data1.ReadOnly = False
End Sub

Private Sub 总揽全局_Click()
SSTab1.Tab = 3
End Sub

⌨️ 快捷键说明

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