| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1743 人关注过本帖
标题:编写校友通讯录程序
取消只看楼主 加入收藏
Loveyourself
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2007-6-18
收藏
得分:0 
代码
Option Explicit
private Sub Command1_click()
Data1.Recordset.AddNew. '添加新记录
End Sub

Private Sub Command2_Click()
Data1.UpdateRecord '添加记录后更新
Data1.Recordset.Bookmark=Data Recordset_Last Modified
End Sub

Private Sub Command3_Click
Dim msg As string '删除记录
msg="是否确定要删除记录"&Chr$(10)
msg=msg&Text1.Text
IfMsgBox(msg,17,"删除记录?")<>1 Then Exit sub
on Error Go To Handle
Data1.Recordset.MoveNext
If Data1.Recordset.EOFThen Date1.Recordset.MovePrevious
Handle:
Msg Box"该记录不能删除!!" '原记录不能被删除
End sub

Private Sub Commond_Click()
Dim msgfind As string '查找记录
msgfind=Input Box("请输入要查找的公司名:","查找记录"
If msgfind<>""Then data1.Recordset.FindFirst("[companyName]=msgfind"
End Sub
private Sub Command5_Click()
End
End Sub




生命理应追求阳光
2007-06-21 16:04
Loveyourself
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2007-6-18
收藏
得分:0 
回复:(hearo)很好吗,继续努力
谢谢啦

生命理应追求阳光
2007-06-21 16:06
Loveyourself
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2007-6-18
收藏
得分:0 

Private Sub Cmdfind_Click()

datH.Recordset.FindFirst "Name= '" & txtN.Text & "'"
If datH.Recordset.NoMatch = True Then
MsgBox "没有查找到!"
datH.Refresh
End If
End Sub

Private Sub Command1_Click()
datH.Recordset.MovePrevious
If datH.Recordset.BOF = True Then
datH.Recordset.MoveFirst
End If
End Sub

Private Sub Command2_Click()
datH.Recordset.MoveNext
If datH.Recordset.EOF = True Then
datH.Recordset.MoveLast
End If
End Sub

Private Sub Command3_Click()
datH.Recordset.AddNew
datH.Recordset.Update
datH.Recordset.MoveLast
End Sub

Private Sub Command4_Click()
With datH.Recordset
If .RecordCount > 1 Then
If MsgBox("确定删除吗?", vbYesNo, "提示信息") = vbYes Then
.Delete
.MoveNext
If .EOF = True Then
.MoveLast
End If
End If
Else
MsgBox "库中只剩最一条记录,不能删除!"
End If
End With
End Sub

Private Sub Form_Load()
Dim str As String '定义
str = App.Path
If Right(str, 1) <> "\" Then
str = str + "\"
End If
datH.DatabaseName = str & "\Address01.mdb"
datH.RecordSource = "通讯录"
datH.Refresh

End Sub

Private Sub txtExit_Click()
End
End Sub


谁需要自己来拿


生命理应追求阳光
2007-06-22 07:42
Loveyourself
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2007-6-18
收藏
得分:0 
回复:(Joforn)写好之后就可以直接参加PK赛了http:/...

我没有时间啊,嗯,对不起啊,我最近很忙的,一直到7月4号,天天有考试和要学习的时间,,不好意思啦


生命理应追求阳光
2007-06-22 08:28
Loveyourself
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2007-6-18
收藏
得分:0 

Private Sub cmdExit_Click()
End
End Sub

Private Sub cmdFind_Click()
datH.Recordset.FindFirst "Name='" & txtN.Text & " ' "
If datH.Recordset.NoMatch = True Then
MsgBox "没有查找到!"
datH.Rerfresh
End If
End Sub

Private Sub Command1_Click()
datH.Recordset.MovePrevious
If datH.Recordset.BOF = True Then
datH.Recordset.MoveFirst
End If
End Sub

Private Sub Command2_Click()
datH.Recordset.MoveNext
If datH.Recordset.EOF = True Then
datH.Recordset.MoveLast
End If
End Sub

Private Sub Command3_Click()
datH.Recordset.AddNew
datH.Recordset.Update
datH.Recordset.MoveLast
End Sub

Private Sub Command4_Click()
With datH.Recordset
If .RecordCount > 1 Then
If MsgBox("确定删除吗?", vbYesNo, "提示信息") = vbYes Then
.Delete
.MoveNext
If .EOF = True Then
.MoveLast
End If
End If
Else
MsgBox "库中只剩最后一条记录,不能删除!"
End If
End With
End Sub


生命理应追求阳光
2007-06-22 19:40
Loveyourself
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2007-6-18
收藏
得分:0 

最基本的命令和代码,有谁需要用自己看

Private Sub cmdA_Click()
With datH.Recordset
.AddNew
.Update
.MoveLast
End With
End Sub

Private Sub cmdD_Click()
If datH.Recordset.RecordCount <> 1 Then
datH.Recordset.Delete
If datH.Recordset.EOF Then
datH.Recordset.MoveNext
End If
datH.Refresh
Else
MsgBox "最后一条不能再则除", vbOKOnly, "信息提示"
End If
End Sub

Private Sub cmdE_Click()
End
End Sub

Private Sub cmdF_Click()
datH.Recordset.FindFirst "姓名='" & txtN.Text & "'"
If datH.Recordset.NoMatch = True Then
MsgBox "没有查找到!"
datH.Refresh
End If
End Sub

Private Sub cmdR_Click()
datH.Refresh
End Sub

Private Sub Form_Load()
Dim str As String '定义
str = App.Path
If Right(str, 1) <> "\" Then
str = str + "\"
End If
datH.DatabaseName = str & "123.mdb"

datH.RecordSource = "校友通讯录"
datH.Refresh
End Sub


生命理应追求阳光
2007-06-25 19:44
快速回复:编写校友通讯录程序
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025343 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved