设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

12
返回列表 发新帖
楼主: mzjlgjf
打印 上一主题 下一主题

[与其它组件] 为什么记录到了3万多条的时候就出现部分按钮失效?

[复制链接]
11#
发表于 2007-6-20 23:55:00 | 只看该作者
Dim stemp As String
Dim i As Integer
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
stemp = "select * from 报表 where id = " & Me.Text8
rs.Open stemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic

If rs.RecordCount = 0 Then
MsgBox "无修改记录", vbCritical, "提示"
Exit Sub
End If
rs.Delete
rs.Update


MsgBox "删除成功", vbExclamation, "提示"

Me![报表查询].Requery
Set rs = Nothing

'以上是删除

'以下是修改

If Me.Command2.Caption = "修改" Then
Me.板号.Visible = False
Me.日期.Visible = False
Me.组别.Visible = False
Me.工号.Visible = False
Me.姓名.Visible = False
Me.号数.Visible = False
Me.级别.Visible = False
Me.面数.Visible = False
Me.中数.Visible = False
Me.颜色.Visible = False
Me.数量.Visible = False
Me.Text1.Visible = False
Me.Text2.Visible = False
Me.Text3.Visible = False
Me.Command1.Enabled = False
Me.Command3.Enabled = False
Me.Command2.Caption = "保存"
Else

Dim stemp As String
Dim i As Integer
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
stemp = "select * from 报表 where id=" & Me.Text8
rs.Open stemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic

If rs.RecordCount = 0 Then
MsgBox "无修改记录", vbCritical, "提示"
Exit Sub
End If
rs("日期") = Me![txt日期]
rs("工号") = Me![txt工号]
rs("组别") = Me![txt组别]
rs("姓名") = Me![txt姓名]
rs("号数") = Me![txt号数]
rs("级别") = Me![txt级别]
rs("面数&厚薄") = Me![txt面数]
rs("板号") = Me![txt板号]
rs("中数") = Me![txt中数]
rs("颜色") = Me![txt颜色]
rs("数量") = Me![txt数量]
rs.Update
Me![报表查询].Requery
MsgBox "修改成功", vbExclamation, "提示"
rs.Close
  Set rs = Nothing
Me.板号.Visible = True
Me.日期.Visible = True
Me.组别.Visible = True
Me.工号.Visible = True
Me.姓名.Visible = True
Me.号数.Visible = True
Me.级别.Visible = True
Me.面数.Visible = True
Me.中数.Visible = True
Me.颜色.Visible = True
Me.数量.Visible = True
Me.Text1.Visible = True
Me.Text2.Visible = True
Me.Text3.Visible = True
Me.日期.SetFocus
Me.Command1.Enabled = True
Me.Command3.Enabled = True
Me.Command2.Caption = "修改"

12#
 楼主| 发表于 2007-6-21 01:17:00 | 只看该作者
太感激了,请问一下,为什么我那个不行呢?
13#
发表于 2007-6-21 01:35:00 | 只看该作者
注重一下方法,多看别人是怎么实现的,你的我没留意去看,只是看到代码比较乱,整理了一下.
14#
 楼主| 发表于 2007-6-21 02:11:00 | 只看该作者
哦,好的,谢谢了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-15 18:12 , Processed in 0.077563 second(s), 26 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表