Foxtable(狐表)用户栏目专家坐堂 → 求助增加多行时很慢


  共有2446人关注过本帖平板打印复制链接

主题:求助增加多行时很慢

帅哥哟,离线,有人找我吗?
大红袍
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/9/11 15:57:00 [只看该作者]

Tables("打印产品.生产编码").AddNew() '增加行
'光标定位在新增加行
If Tables("打印产品.生产编码").Current IsNot Nothing Then
    Tables("打印产品.生产编码").Select(Tables("打印产品.生产编码").Current.Index,Tables("打印产品.生产编码").Cols("产品类别").Index)
    Tables("打印产品.生产编码").StartEditing
End If

Dim n As Integer = 5
If InputValue(n, "行数", "增加多少行?") Then
    DataTables("生产编码").StopRedraw
    systemready = False
   
    Dim max As String
    Dim idx As Integer
    max = Tables("打印产品.生产编码").Compute("Max(日编号)","日期 = #" & Tables("打印产品").Current("日期") & "#") '取得该天的最大编号
    If max > "" Then '如果存在最大编号
        idx = CInt(max.Substring(9,3)) + 1 '获得最大编号的后三位顺序号,并加1
    Else
        idx = 1 '否则顺序号等于1
    End If
   
    For i As Integer = 1 To n
        Dim nr = Tables("打印产品.生产编码").AddNew
        nr("编号")= Format(Tables("打印产品").Current("日期"),"yyyyMMdd") '日期转换字符
        nr("日编号")= nr("编号") & "-" & format(idx + i - 1, "000")
    Next
    systemready = True
    DataTables("生产编码").ResumeRedraw
    DataTables("生产编码").DataCols("二维码编号").Expression = "IIF([分支器] Like '空%',[姓名]+':'+[类别代码]+'-'+[日编号],[姓名]+':'+[分支器]+[类别代码]+'-'+[日编号])"
End If


 回到顶部
总数 13 1 2 下一页