以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]按钮  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=107107)

--  作者:江南小镇
--  发布时间:2017/9/21 11:49:00
--  [求助]按钮
老师,下面代码不能按指定的单元格打开文件,而是必须关闭窗口后重新指定单元格才能打开,打开后又有关闭窗口后重新指定才能打开。


If GetConfigValue("文件夹路径" & ComputerId,"") = "" Then
    MessageBox.Show("请先指定存储路径!","提醒")
    Return
End If

If Tables("入库.入库明细").Current.isnull("票据原件") = True Then  \'若未存储文件名
    MessageBox.Show("未上传文件!","提醒")
    Return
End If

If e.Form.Controls("文件名").text = "文件已被删除!" Then
    Tables("入库.入库明细").Current("票据原件") = Nothing
    e.Form.Controls("文件名").text = "未上传文件!"
    e.Form.Controls("PictureBox1").image = getimage("other.png")
    Return
End If

Dim proc As new Process
proc.File = e.Form.Controls("路径").text & "\\" & e.Form.Controls("文件名").text
proc.Start

--  作者:有点甜
--  发布时间:2017/9/21 12:33:00
--  

试试改成

 

msgbox(e.Form.Controls("路径").text)

msgbox(e.Form.Controls("文件名").text)

Dim proc As new Process
proc.File = e.Form.Controls("路径").text & "\\" & Tables("入库.入库明细").Current("票据原件")
proc.Start