小问题:

wangluoxing 2002-05-06 09:36:02
有一语句: For i = 0 To tmprst.recordcount - 1
If trim$(tmprst.Fields(0).Value) <> curNo Then
MsgBox "编号为" & strValue(0) & "的教学区已经存在,请重新设置编号。", vbOKOnly Or vbCritical, "错误提示"
txtJXNum.SetFocus
txtJXNum.SelLength = Len(Trim$(txtJXNum.Text))
Exit Sub
End If
next i
问题:当trim$(tmprst.fields(0).value)=curno时运行then后语句:他们都为string型:比如都等以02时,仍运行 then msgbox "................"
请各位帮忙啊:
...全文
117 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangluoxing 2002-05-06
  • 打赏
  • 举报
回复
上面的兄弟:都不可以啊
MoQi_123 2002-05-06
  • 打赏
  • 举报
回复
少了一个tmprst.MoveNext
正确代码为:
tmprst.MoveFirst
: For i = 0 To tmprst.recordcount - 1
If trim$(tmprst.Fields(0).Value) <> curNo Then
MsgBox "编号为" & strValue(0) & "的教学区已经存在,请重新设置编号。", vbOKOnly Or vbCritical, "错误提示"
txtJXNum.SetFocus
txtJXNum.SelLength = Len(Trim$(txtJXNum.Text))
Exit Sub
End If

tmprst.MoveNext

next i
jdsbjcailei 2002-05-06
  • 打赏
  • 举报
回复
For i = 0 To tmprst.recordcount - 1
If trim$(tmprst.Fields(0).Value) <> curNo Then
MsgBox "编号为" & strValue(0) & "的教学区已经存在,请重新设置编号。", vbOKOnly Or vbCritical, "错误提示"
txtJXNum.SetFocus
txtJXNum.SelLength = Len(Trim$(txtJXNum.Text))
Exit Sub
else
'加上这个else试试
End If
next i
jdsbjcailei 2002-05-06
  • 打赏
  • 举报
回复
If trim$(tmprst.Fields(0).Value) <> curNo Then
MsgBox "编号为" & strValue(0) & "的教学区已经存在,请重新设置编号。", vbOKOnly Or vbCritical, "错误提示"
txtJXNum.SetFocus
txtJXNum.SelLength = Len(Trim$(txtJXNum.Text))
Exit Sub
else
'加上这个else才是完整的if then语句
End If
next i
jjjwltcs 2002-05-06
  • 打赏
  • 举报
回复
请关注下面的贴子
http://www.csdn.net/expert/topic/701/702000.xml?temp=.9355738
ivt 2002-05-06
  • 打赏
  • 举报
回复
如果都等于2会怎样呢

7,785

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧