以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  求助~~~索引-1不是负数就是大于行数 问题~~  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=10728)

--  作者:zbsczh
--  发布时间:2011/6/20 16:27:00
--  求助~~~索引-1不是负数就是大于行数 问题~~

求助。。

不知道为什么在点击出库窗口-保存的时候,老是出这个错。。

条件是物料号在库存里不存在的时候

 

代码我调试过,定位的差不多是下面一段。

谁能帮我解答一下,谢谢

 

 With Tables("库存")
                                                                        Dim flag As Integer
                                                                        flag = .Find(cstr(m1),0,"物料号",False,True,True)
                                                                        If flag > -1 And .Rows(flag)("可用库存") >= quantity Then
                                                                            .Rows(flag)("可用库存") = .Rows(flag)("可用库存") - quantity
                                                                            .Rows(flag)("当前库存") = .Rows(flag)("当前库存") - quantity
                                                                            \'.Rows(flag)("库存总价") = .Rows(flag)("库存总价") + amount
                                                                           
                                                                            With Tables("出库")
                                                                                If .Current IsNot Nothing Then
                                                                                    .Current.Locked = True
                                                                                End If
                                                                            End With
                                                                        ElseIf flag > -1 And .Rows(flag)("可用库存") < quantity Then
                                                                            e.Cancel = True
                                                                            Messagebox.Show("   实领数量不能大于可用库存数量!", "提示", MessageBoxButtons.OK,MessageBoxIcon.Information)
                                                                        Else
                                                                            e.Cancel = True
                                                                            Messagebox.Show("   当前输入的物料号在库存中不存在,请输入正确的物料号!", "提示", MessageBoxButtons.OK,MessageBoxIcon.Information)
                                                                        End If
                                                                    End With

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:仓库管理模板_20110609.table


--  作者:狐狸爸爸
--  发布时间:2011/6/20 16:33:00
--  

参考下面的:

 

http://help.foxtable.com/topics/1485.htm

 

看看问题出在哪一行。


--  作者:狐狸爸爸
--  发布时间:2011/6/20 16:36:00
--  

注意:

 

ElseIf flag > -1 And .Rows(flag)("可用库存") < quantity Then

 

应该改为:

 

ElseIf flag > -1 AndAlso .Rows(flag)("可用库存") < quantity Then

 

类似的全部改!!!


--  作者:zbsczh
--  发布时间:2011/6/20 16:48:00
--  

汗,果真如此。。。

and andalso。。。