#Name? error on Control Source from Query

  • Thread starter Thread starter Sandy
  • Start date Start date
S

Sandy

I have a query (which is based on a sub query) as follows:

SELECT Max(t_costs.DelDate) AS MaxOfDelDate
FROM [q_MaxOfBBOMDeliveryDate-Sub] INNER JOIN t_costs ON
([q_MaxOfBBOMDeliveryDate-Sub].MaxOfBOMRev = t_costs.BOMRev) AND
([q_MaxOfBBOMDeliveryDate-Sub].Job_ID = t_costs.Job_ID) AND
([q_MaxOfBBOMDeliveryDate-Sub].BOMType = t_costs.BOMType);

The control source for my unbound field is:
=[q_MaxOfBBOMDeliveryDate]![MaxOfDelDate]

.... but this is giving me a #Name? error.

Format of the control is Medium Date

Your help would be appreciated.

thanks
sandra
 
Sandy,
use a dlookup to get the value for the unbound field.
set its control source =DLookup( "[MaxOfDelDate]", "NameOfQuery",
strCriteria)
build the strCriteria using the fields that uniquely identify the record on
your form.
Check out vba help on Dlookup.


Jeanette Cunningham -- Melbourne Victoria Australia
 
Thanks, Jeanette - this worked perfectly.

I used
= DLookup( "[MaxOfDelDate]", "NameOfQuery")

with no criteria as that was already defined in the query, which returns
only one record and one field

:-)
s-

Jeanette Cunningham said:
Sandy,
use a dlookup to get the value for the unbound field.
set its control source =DLookup( "[MaxOfDelDate]", "NameOfQuery",
strCriteria)
build the strCriteria using the fields that uniquely identify the record on
your form.
Check out vba help on Dlookup.


Jeanette Cunningham -- Melbourne Victoria Australia


Sandy said:
I have a query (which is based on a sub query) as follows:

SELECT Max(t_costs.DelDate) AS MaxOfDelDate
FROM [q_MaxOfBBOMDeliveryDate-Sub] INNER JOIN t_costs ON
([q_MaxOfBBOMDeliveryDate-Sub].MaxOfBOMRev = t_costs.BOMRev) AND
([q_MaxOfBBOMDeliveryDate-Sub].Job_ID = t_costs.Job_ID) AND
([q_MaxOfBBOMDeliveryDate-Sub].BOMType = t_costs.BOMType);

The control source for my unbound field is:
=[q_MaxOfBBOMDeliveryDate]![MaxOfDelDate]

... but this is giving me a #Name? error.

Format of the control is Medium Date

Your help would be appreciated.

thanks
sandra
 
Back
Top