窗口(外部数据源):TextBox1输入要查的关键字,只对第一列进行后台模糊查找,且只查找包含关键字的最近一条记录,填写到TextBox2中,这个按钮代码该如何写?
dim dr as datarow = datatables("xx表").sqlfind("第一列 like '%" & e.form.controls("TextBox1").text & "%'","[日期] desc")
if dr isnot nothing then
e.form.controls("TextBox2").text = dr("第一列")
endif
老师好!原是access可以用的,现再改成SQL,提示有:'#' 附近有语法错误。应该如何修改啊
Dim Filter As String
With e.Form.Controls("承运车主")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "承运车主 = '" & .Value & "'"
End If
End With
With e.Form.Controls("StartDate")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "承运日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("EndDate")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "承运日期 <= #" & .Value & "#"
End If
End With
If Filter > "" Then
DataTables("承运人明细表").loadFilter = Filter
DataTables("承运人明细表").load
Else
DataTables("承运人明细表").loadFilter = ""
DataTables("承运人明细表").load
End If