Private Sub txtBarCode_Change()
Dim i As Integer
If Len(Trim(Me.txtBarCode.text)) = 9 Then
Me.Cell1.SetCurSheet (0)
If Me.Cell1.GetRows(0) > 4 Then
For i = 0 To Me.Cell1.GetRows(0)
If Trim(Me.Cell1.GetCellString(1, i + 4, 0)) = Trim(Me.txtBarCode.text) Then
Me.Cell1.SetCellDouble 2, i + 4, 0, 1
Cell1.SetCellTextColor 1, 4 + i, 0, Cell1.FindColorIndex(RGB(255, 0, 0), 1)
' Else
' MsgBox ("没有输入的票号!")
End If
Next
End If
Me.txtBarCode.text = ""
Me.txtBarCode.SetFocus
End If
End Sub
我想在Trim(Me.Cell1.GetCellString(1, i + 4, 0)) <>Trim(Me.txtBarCode.text)的情况下,MsgBox ("没有输入的票号!")这个消息框,可是我加进去,出现几行记录就有几个消息框,怎么处理啊,我只想要一个就是需要写一个小算法,记录比较情况吧,可我不知道怎么写
Dim i As Integer
If Len(Trim(Me.txtBarCode.text)) = 9 Then
Me.Cell1.SetCurSheet (0)
If Me.Cell1.GetRows(0) > 4 Then
For i = 0 To Me.Cell1.GetRows(0)
If Trim(Me.Cell1.GetCellString(1, i + 4, 0)) = Trim(Me.txtBarCode.text) Then
Me.Cell1.SetCellDouble 2, i + 4, 0, 1
Cell1.SetCellTextColor 1, 4 + i, 0, Cell1.FindColorIndex(RGB(255, 0, 0), 1)
' Else
' MsgBox ("没有输入的票号!")
End If
Next
End If
Me.txtBarCode.text = ""
Me.txtBarCode.SetFocus
End If
End Sub
我想在Trim(Me.Cell1.GetCellString(1, i + 4, 0)) <>Trim(Me.txtBarCode.text)的情况下,MsgBox ("没有输入的票号!")这个消息框,可是我加进去,出现几行记录就有几个消息框,怎么处理啊,我只想要一个就是需要写一个小算法,记录比较情况吧,可我不知道怎么写
解决方案 »
- 求教rmvb解码的问题
- 怎么删除数据库里的所有记录?
- vba中用宏建立Excel中的下拉列表时,当项中的字符数大于255时会被截断,如何解决
- VB开发ActiveX组件如何连接远程网页获取代码,另外ActiveX中可否做窗体事件,组件是应用在IE扩展的;谢谢!
- ComboBox拉下菜单一下只能显示8个内容,能不能增加一次(一次显示20个)显示的内容?
- 唉,CSDN再这样虐待用户,我只能采取以下这种极端手法了:
- activereports for .net换页问题
- 关于sql语句中存在text空间的问题
- 请问在VB中如何声明未注册的。DLL文件
- 怎么在VB中得到2GB以上的磁盘空间?
- 服务器自动作业 出现什么问题
- 关于XML的编程
Private Sub txtBarCode_Change()
Dim i As Integer, iTest% If Len(Trim(Me.txtBarCode.text)) = 9 Then
Me.Cell1.SetCurSheet (0)
If Me.Cell1.GetRows(0) > 4 Then
iTest = 0
For i = 0 To Me.Cell1.GetRows(0)
If Trim(Me.Cell1.GetCellString(1, i + 4, 0)) = Trim(Me.txtBarCode.text) Then
Me.Cell1.SetCellDouble 2, i + 4, 0, 1
Cell1.SetCellTextColor 1, 4 + i, 0, Cell1.FindColorIndex(RGB(255, 0, 0), 1)
iTest = 1: Exit For
End If
Next
if (iTest = 0) then MsgBox "没有输入的票号!", 48, "票号错误"
End If
Me.txtBarCode.text = ""
Me.txtBarCode.SetFocus
End If
End Sub