注册 登录
Office中国论坛/Access中国论坛 返回首页

rcylbx的个人空间 http://www.office-cn.net/?52107 [收藏] [复制] [分享] [RSS]

日志

一段查找代码

已有 1906 次阅读2009-3-16 23:21 |个人分类:程序设计|

 Dim rs As New ADODB.Recordset
   
    If IsNull(Me.id) Or Me.id = "" Then
        MsgBox "请输入要查找的 id", vbExclamation + vbOKOnly, "查找"
        id.SetFocus
    Else
        If Not IsNumeric(Me.id) Then
            MsgBox "id 为数字值, 请重输", vbExclamation + vbOKOnly, "查找"
            id.SetFocus
        Else
            With rs
                .Open "SELECT * FROM lge WHERE id=" & Me.id, CurrentProject.Connection
                If .EOF And .BOF Then
                    MsgBox "没有找到 id 为" & Me.id & " 值的记录, 请重输 id", vbExclamation + vbOKOnly, "查找"
                    id.SetFocus
                Else
                    Me.日期 = rs("日期")
                    Me.车辆 = rs("车辆")
                    Me.当日里程 = rs("当日里程")
                   
                    Call SetButt("查看")
                End If
            End With
        End If
    End If

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册

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

GMT+8, 2024-11-25 05:31 , Processed in 0.164139 second(s), 17 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

返回顶部