为什么要再点一下当前表,才正确执行下面的代码,我点击菜单,第一次输出句“MessageBox.Show("未找到:" & lj & "Attachments\" & str1)”,如果我再点一下当前表,就找到了图片了。
——————————————————————————————————————————————————————————————————————————————
Forms("幼教成绩册").Open
If MessageBox.Show("批量导入照片一般用于人员信息导入之后操作,如果确定已经完成基础数据导入,可以使用本功能" & vbcrlf & "系统默认会在程序的Attachments文件夹内搜索文件!!","提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning) = dialogresult.ok Then
If CurrentTable.Rows.Count > 0 Then
Dim lj As String = ProjectPath
For Each dr As Row In CurrentTable.Rows
Dim str1 As String =dr("姓名") & ".jpg"
If FileSys.FileExists("" & lj & "Attachments\" & str1 & "") = True Then
dr("照片") = dr("姓名") & ".jpg"
Else
MessageBox.Show("未找到:" & lj & "Attachments\" & str1)
dr("照片") = Nothing
End If
Next
Else
MessageBox.Show("当前表没有数据,无法执行该操作!","错误",MessageBoxButtons.OK,MessageBoxIcon.Error)
End If
End If
[此贴子已经被作者于2020/6/22 15:14:19编辑过]