以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]跨表查询引用问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=196577)

--  作者:zhengcy
--  发布时间:2025/5/14 11:06:00
--  [求助]跨表查询引用问题
各位大佬,有一个跨表查询引用问题咨询一下。
目前有一个主表“工时列表”,这个表里面有数据,然后现在另起了一个表,在这个表里输入筛选的条件,但是输入条件后按下查询按钮,并不会有数据引用过来。帮助看一下我这是查询代码有问题吗?

以下是查询按键代码:

Dim qr As DataRow
Dim r As Row
Dim sd As Date
Dim ed As Date
Dim gc As String

With e.Form.Controls("TextBox1")
    If .Value IsNot Nothing Then
        gc = e.Form.Controls("TextBox1").text
    End If 
End With
With e.Form.Controls("StartDate")
    If .Value IsNot Nothing Then
        sd = e.Form.Controls("StartDate").Value 
    End If
End With
With e.Form.Controls("EndDate")
    If .Value IsNot Nothing Then
        ed = e.Form.Controls("EndDate").Value 
     End If
End With
 
qr = DataTables("工时列表").SQLFind(" [工厂]= \'" & gc & "\' And  [提交日期]=> #" & sd & "# And [提交日期]<= #" & ed & "# ")
 
If qr IsNot Nothing Then
    r("当前进度") = qr("审批进度")
    r("采购单号") = qr ("工单号")
    r("总工时s") = qr("总工时s")
    r("工厂") = qr("工厂")
    r("品名") = qr("品名")
    r("工单数量") = qr("工单数量")
    r("提交日期") = qr("提交日期")
End If

--  作者:有点蓝
--  发布时间:2025/5/14 11:20:00
--  
生成条件参考这种方式:http://www.foxtable.com/webhelp/topics/1058.htm,否则其中一个没有录入条件的情况下,是无法查询的