Text-box reference

  • Thread starter Thread starter Terry
  • Start date Start date
T

Terry

Hello,
I have an unbound form on which I have placed a list box
with the Row Source of (a cross-tab) sql:

TRANSFORM Sum(tbl_ord_ordertrackingsummary.orderqty)
AS SumOforderqty
SELECT tbl_ord_orderstatustype.orderstatus
AS [Order Status]
FROM tbl_ord_ordertrackingsummary
INNER JOIN tbl_ord_orderstatustype
ON tbl_ord_ordertrackingsummary.orderstatusid =
tbl_ord_orderstatustype.id
WHERE (((tbl_ord_ordertrackingsummary.datecreated)>[Forms]!
[frm_ordermgmt_workload]![startDate]))
GROUP BY tbl_ord_orderstatustype.orderstatus
ORDER BY tbl_ord_orderstatustype.orderstatus PIVOT
tbl_ord_ordertrackingsummary.datetime;

I am having trouble with the WHERE clause. I'm trying to
reference an unbound textbox on the same form that has a
default of Date(). I get an error that says "The Microsoft
Jet database engine does not recognize [Forms]!
[frm_ordermgmt_workload]![startDate] as a valid field name
or expression." If it change the WHERE to just >Date(), it
works fine. What is the reason it will not see the
textbox? - Also, I'm using the text box with the date to
adjust the "start date" of the query and then requery the
cross-tab.

Any input is appreciated.

Terry
 
I am not completely shure: the message states it, Access cannot find
that field. It is looking for fields, that sit in the recordsource of
your form, not for controls on the form.

Typing this, would it work if you change
[Forms]![frm_ordermgmt_workload]![startDate]
into
[Forms]![frm_ordermgmt_workload].[startDate]

? Maybe not.

Otherwise, make it a parameter in the query, supply that parameter in code.
 
Back
Top