| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 414 人关注过本帖
标题:[求助]为什么同样的代码在不同的地方,其中一个就会出问题
只看楼主 加入收藏
礼拜六
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2006-4-5
收藏
 问题点数:0 回复次数:0 
[求助]为什么同样的代码在不同的地方,其中一个就会出问题
为什么同样的代码在不同的地方,其中一个就会出问题

Private Sub Command1_Click()
Dim mrc As ADODB.Recordset
txtsql = "select username from use where username='" & Trim(Text1.Text) & "'"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then
MsgBox " 用户名错误!", vbExclamation + vbOKOnly, "警告"
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Exit Sub
End If
username = mrc.Fields(0)
txtsql = "select username from use where password='" & Trim(Text2.Text) & "'"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then
MsgBox " 密码错误!", vbExclamation + vbOKOnly, "警告"
Text2.SetFocus
Text2.SelStart = 0
Text2.SelLength = Len(Text2.Text)
Exit Sub
End If

MDIFrmyingye.Show
Unload Me
--------------------------------------------------------------------------------------------------
以上代码一切正常
Option Explicit
Dim txtsql1 As String

Private Sub cmdbaocun_Click()
Dim www As Integer
If Len(Text1.Text) <> 8 Then
www = MsgBox("您输入的时间格式不正确,请核实从新输入!", vbOKOnly, "警告!")
Text1.SetFocus
Exit Sub
End If
Dim mrc As ADODB.Recordset
txtsql1 = "select 日期 from 日报单 where 日期='" & Text1.Text & "'"
Set mrc = ExecuteSQL(txtsql1)
If mrc.EOF = False Then实时错误‘91’对象变量或with变量没有定义
www = MsgBox("已经存在该学号的记录,学号不能重复!", vbExclamation + vbOKOnly, "警告")
Text1.SetFocus
mrc.Close
End If
End Sub
搜索更多相关主题的帖子: 代码 
2006-04-20 10:39
快速回复:[求助]为什么同样的代码在不同的地方,其中一个就会出问题
数据加载中...
 
   



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

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