求VB个人通讯录管理系统

只要初级了。课程设计用!!有用的... 只要初级了。 课程设计用!! 有用 的 展开
 我来答
水蓝剑月R2A5H
2014-06-12 · 超过21用户采纳过TA的回答
知道答主
回答量:46
采纳率:100%
帮助的人:26.3万
展开全部
希望能帮上你。
通讯录源码:

Public panduan As Integer
Private Sub Combo1_Click()
Data1.Recordset.MoveFirst
Data1.Recordset.FindFirst "姓名='" &
Combo1.Text & "'"
Call xianshi
End Sub

Private Sub Combo2_Click()
Data2.Recordset.MoveLast
Data2.Recordset.FindLast "时间='" &
Combo2.Text & "'"
Call xianshi2
End Sub

Private Sub Command1_Click()
If Data1.Recordset.AbsolutePosition = Data1.Recordset.RecordCount - 1 Then
MsgBox "已经到最后一条记录", 0 + 16, "警告"
Exit Sub
Else
Data1.Recordset.MoveNext
Combo1.Text = Data1.Recordset("姓名")
Call xianshi
End If
End Sub

Private Sub Command10_Click()
If Command10.Caption = "写日记" Then
Text11.Text = ""
Combo2.Text = Text12.Text
Command10.Caption = "保存"
Else

With Data2
.Recordset.AddNew

.Recordset("时间") = Text12
.Recordset("事件") = Text11
.Recordset.Update
End With
Combo2.Clear
Data2.Refresh
Call chushihua2
Call xianshi2
Command10.Caption = "写日记"
End If
End Sub

Private Sub Command11_Click()
a = MsgBox("当前记录将被删除,确定吗?", 4 + 48, "警告")
If a = vbNo Then Exit Sub
Data2.Recordset.Delete
Data2.Refresh
Combo2.Clear
Call chushihua2
End Sub

Private Sub Command12_Click()
Data2.Recordset.MoveLast
Combo2.Text = Data2.Recordset("时间")
Call xianshi2
End Sub

Private Sub Command13_Click()
If Data2.Recordset.AbsolutePosition = 0 Then
MsgBox "这已经是最为古老的日记了", 0 + 16, ""
Exit Sub
Else
Data2.Recordset.MovePrevious
Combo2.Text = Data2.Recordset("时间")
Call xianshi2
End If
End Sub

Private Sub Command14_Click()
If Data2.Recordset.AbsolutePosition = Data2.Recordset.RecordCount - 1 Then
MsgBox "这已经是最新的一篇了", 0 + 16, "警告"
Exit Sub
Else
Data2.Recordset.MoveNext
Combo2.Text = Data2.Recordset("时间")
Call xianshi2
End If
End Sub

Private Sub Command2_Click()
panduan = 1
If Command2.Caption = "添加" Then
Command1.Enabled = False
Command3.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command2.Caption = "保存数据"
Text2.Visible = True
Text3.Visible = True
Text4.Visible = True
Text5.Visible = True
Text6.Visible = True
Text7.Visible = True
Text8.Visible = True
Text9.Visible = True
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""

Else
If Text8.Text = "" Then
MsgBox "请输入完整数据!", 48, "警告"
Text8.SetFocus

Else
a = MsgBox("当前记录将被添加,确定吗?", 4 + 48, "警告")
If a = vbNo Then
Command2.Caption = "添加"
Command1.Enabled = True
Command3.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
Command8.Enabled = True
Command9.Enabled = True
Text2.Visible = False
Text3.Visible = False
Text4.Visible = False
Text5.Visible = False
Text6.Visible = False
Text7.Visible = False
Text8.Visible = False
Text9.Visible = False
Exit Sub

Else
Command2.Caption = "添加"
Command1.Enabled = True
Command3.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
Command8.Enabled = True
Command9.Enabled = True
Data1.Recordset.Edit
With Data1
.Recordset.AddNew
.Recordset("姓名") = Text8.Text
.Recordset("手机号") = Text2
.Recordset("性别") = Text3
.Recordset("工作单位") = Text4
.Recordset("职务") = Text5
.Recordset("电子邮箱") = Text6
.Recordset("联系地址") = Text7
.Recordset("QQ") = Text9
End With
Command2.Caption = "添加"
Text2.Visible = False
Text3.Visible = False
Text4.Visible = False
Text5.Visible = False
Text6.Visible = False
Text7.Visible = False
Text8.Visible = False
Text9.Visible = False
Combo1.Clear
Data1.Refresh
Call chushihua
Call xianshi
End If
End If
End If
End Sub

Private Sub Command3_Click()
If Command3.Caption = "修改" Then
Command1.Enabled = False
Command2.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command3.Caption = "保存修改"
Text2.Visible = True
Text3.Visible = True
Text4.Visible = True
Text5.Visible = True
Text6.Visible = True
Text7.Visible = True
Text8.Visible = True
Text9.Visible = True

Text2.Text = Label12.Caption
Text3.Text = Label13.Caption
Text4.Text = Label14.Caption
Text5.Text = Label15.Caption
Text6.Text = Label16.Caption
Text7.Text = Label17.Caption
Text8.Text = Combo1.Text
Text9.Text = Label18.Caption
Else
If Text8.Text = "" Then
MsgBox "请输入完整数据!", 48
Text8.SetFocus

Else
a = MsgBox("当前记录将被修改,确定吗?", 4 + 48, "警告")
If a = vbNo Then
Command3.Caption = "修改"
Command1.Enabled = True
Command2.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
Command8.Enabled = True
Command9.Enabled = True
Text2.Visible = False
Text3.Visible = False
Text4.Visible = False
Text5.Visible = False
Text6.Visible = False
Text7.Visible = False
Text8.Visible = False
Text9.Visible = False
Exit Sub
Else
Command3.Caption = "修改"
Command1.Enabled = True
Command2.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
Command8.Enabled = True
Command9.Enabled = True
Data1.Recordset.Edit
With Data1
.Recordset("姓名") = Text8.Text
.Recordset("手机号") = Text2
.Recordset("性别") = Text3
.Recordset("工作单位") = Text4
.Recordset("职务") = Text5
.Recordset("电子邮箱") = Text6
.Recordset("联系地址") = Text7
.Recordset("QQ") = Text9
End With
Command3.Caption = "修改"
Text2.Visible = False
Text3.Visible = False
Text4.Visible = False
Text5.Visible = False
Text6.Visible = False
Text7.Visible = False
Text8.Visible = False
Text9.Visible = False
Combo1.Clear
Data1.Refresh
Call chushihua
Call xianshi
End If
End If
End If
End Sub

Private Sub Command4_Click()
If Command3.Caption = "保存修改" Or
Command2.Caption = "保存数据" Then
Command3.Caption = "修改"
Command2.Caption = "添加"
Text2.Visible = False
Text3.Visible = False
Text4.Visible = False
Text5.Visible = False
Text6.Visible = False
Text7.Visible = False
Text8.Visible = False
Text9.Visible = False
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
Command8.Enabled = True
Command9.Enabled = True
Combo1.Clear
Data1.Refresh
Call chushihua
Call xianshi
Else

End
End If
End Sub

Private Sub Command5_Click()
a = MsgBox("当前记录将被删除,确定吗?", 4 + 48, "警告")
If a = vbNo Then Exit Sub
Data1.Recordset.Delete
Data1.Refresh
Combo1.Clear
Call chushihua
End Sub

Private Sub Command6_Click()
If Data1.Recordset.AbsolutePosition = 0 Then
MsgBox "已经到达第一条了", 0 + 16, ""
Exit Sub
Else
Data1.Recordset.MovePrevious
Combo1.Text = Data1.Recordset("姓名")
Call xianshi
End If
End Sub

Private Sub Command7_Click()
Data1.Recordset.MoveFirst
Combo1.Text = Data1.Recordset("姓名")
Call xianshi
End Sub

Private Sub Command8_Click()
Data1.Recordset.MoveLast
Combo1.Text = Data1.Recordset("姓名")
Call xianshi
End Sub

Private Sub Command9_Click()
Data1.Recordset.MoveFirst
Data1.Recordset.FindFirst "手机号='" &
Text10.Text & "'"
Combo1.Text = Data1.Recordset("姓名")
If Data1.Recordset.NoMatch Then
MsgBox "查无此人!", 48, "注意"
Else

Call xianshi
End If
Call xianshi
End Sub

Private Sub Form_Initialize()
Data1.Refresh
Data2.Refresh
Call chushihua
Call chushihua2
End Sub
Sub gengxin()
Data1.Recordset.MoveFirst
Data1.Recordset.Update
Data1.Recordset.Edit
End Sub
Sub chushihua()
Data1.Recordset.MoveFirst

Do While Data1.Recordset.EOF = False
Combo1.AddItem Data1.Recordset("姓名")

Data1.Recordset.MoveNext
Loop
jlzs = Data1.Recordset.RecordCount
Text1.Text = jlzs
Data1.Recordset.MoveFirst
Combo1.Text = Data1.Recordset("姓名")

Call xianshi
End Sub

Private Sub Form_Load()
Data1.DatabaseName = "db1.mdb"
Data2.DatabaseName = "db2.mdb"
Data1.RecordSource = "表2"
Data2.RecordSource = "表1"
Dim jlzs As Integer

End Sub
Private Sub Combo1_keyup(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Data1.Recordset.MoveFirst
Data1.Recordset.FindFirst "姓名='" &
Combo1.Text & "'"
Combo1.Text = Data1.Recordset("姓名")
If Data1.Recordset.NoMatch Then
MsgBox "查无此人!", 48, "注意"
Else

Call xianshi
End If
End If
End Sub

Sub xianshi()

Label8.Caption = "当前记录号:"
& Data1.Recordset.AbsolutePosition + 1
End Sub
Sub xianshi2()
Text11 = Data2.Recordset("事件")
End Sub

Sub chushihua2()
Data2.Recordset.MoveFirst

Do While Data2.Recordset.EOF = False
Combo2.AddItem Data2.Recordset("时间")
Text11 = Data2.Recordset("事件")
Data2.Recordset.MoveNext
Loop

Data2.Recordset.MoveFirst
Combo2.Text = Data2.Recordset("时间")
Text11 = Data2.Recordset("事件")
Call xianshi
End Sub

Private Sub Text10_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Data1.Recordset.MoveFirst
Data1.Recordset.FindFirst "手机号='" &
Text10.Text & "'"
Combo1.Text = Data1.Recordset("姓名")
If Data1.Recordset.NoMatch Then
MsgBox "查无此人!", 48, "注意"
Else

Call xianshi
End If
End If
End Sub

Private Sub Timer1_Timer()
If Label19.Left + Label19.Width > 0 Then
Label19.Move Label19.Left - 20
Else
Label19.Left = Form1.ScaleWidth
End If
End Sub

Private Sub Timer2_Timer()
Text12.Text = Now
End Sub
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式