如图
父表和子表已经建立了 父表.推荐测评号=子表.推荐号 的关联,现在想实现:点击按钮“印”时,取定父表的当前关联行,再执行生成excel任务。
目前按钮“印”的代码:
'自动判断使用excel模板
If Tables("父表").Current IsNot Nothing Then
Dim txt As String = Tables("父表").Current("类型").SubString(2)
Dim path As String
If txt = "会议推荐" Or txt = "二次推荐" Then
path = "Attachments\推荐登记表.xls"
Else If txt = "谈话推荐" Then
path = "Attachments\谈话推荐登记表.xls"
Else
msgbox("没有相应的Excel模板!")
End If
If path > "" Then
Dim Book As New XLS.Book(ProjectPath & path)
Dim fl As String = ProjectPath & "Reports\推荐登记表.xls"
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
Dim Proc As New Process '打开工作簿
Proc.File = fl
Proc.Start()
End If
End If