Dim xj As WinForm.TextBox = e.Form.Controls("作废收购凭证号")
With Tables("收购")
Dim rr As Integer
If rr=.findrow("[收购凭证号] like '" & xj.Text & "'And [作废] = true ") Then
If rr > 0 Then '如果找到的话
MessageBox.Show("该收购凭证已作废!")
End If
ElseIf rr=.findrow("[收购凭证号] like '" & xj.Text & "' And [作废] = false ") Then
If rr > 0 Then '如果找到的话
.Position = rr '定位到找到的行.
If Functions.Execute("net20sp1") = False Then
Return
End If
Dim Book As New XLS.Book(ProjectPath & "Attachments\作废收购单.xls")
Dim fl As String = ProjectPath & "Reports\作废收购单.xls"
Book.Build()
Book.Save(fl)
Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(fl)
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Ws.PrintOut
App.Quit
Dim r As Row = Tables("收购").Current
Dim dr As DataRow = DataTables("收购").addnew
r("修改") = False
r("打印") = False
r("作废") = False
dr("编号")=r("编号") & "-" & "已作废"
dr("猪主姓名")=r("猪主姓名")
dr("重量")=r("重量")
dr("单价")=r("单价")
dr("日期")=r("日期")
dr("年")=r("年")
dr("月")=r("月")
dr("日")=r("日")
dr("修改")=True
dr("打印")=True
dr("收购凭证号")=r("收购凭证号")
dr("字符日期")=r("字符日期")
dr("作废")=True
dr("销售已录入")=r("销售已录入")
r("收购凭证号") = ""
End If
End If
End With
上述代码我想效果是:在文本框中的输入作废的收购凭证号,然后点击作废控件(上述代码)并且能同时处理多条符合条件的,但不起作用。
是不是代码: If rr=.findrow("[收购凭证号] like '" & xj.Text & "'And [作废] = true ") Then 出现问题?