设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 987|回复: 3
打印 上一主题 下一主题

[宏/菜单/工具栏] 【求助】哪位好心帮个忙修改下代码,不知道出了什么问题!

[复制链接]
1#
发表于 2008-3-29 22:14:20 | 显示全部楼层
Private Sub Text0_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then
   
        Dim rst As New ADODB.Recordset
        Dim strSQL As String
        
        strSQL = "select 电话 from B where 客户名称 = '" & Text0.Text & "'"
        rst.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
        
        Text1.SetFocus
        Text1.Text = rst("电话")
        
        If rst("电话").Value = "" Then
            MsgBox "没有该客户对应的电话!"
        End If
        
        rst.Close
        Set rst = Nothing
   
    End If
End Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-15 11:43 , Processed in 0.075881 second(s), 24 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

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