Marshall said:
nlee144(NoSpamTakeSquareRootOfNumber) wrote:
That error message is caused by an undefined term in the
query. If the query runs fine when you run it directly from
the query design window, then it probably has either a
pop-up prompt for a value or a reference to a control on a
form. If that's what you have, then we have to open the
recordset somewhat differently, because VBA does not
automatically resolve query parameters the way Access does.
If you need more help with this issue, then I'll need to see
a copy/paste of the query's SQL view along with an
explanation of what your using for parameters in the query.
Yes, that is what happens. One field, Supplier, of the query is bound to
a control on my form. It's called [Forms]![Switchboard]![Supplier List].
Here is the paste of the SQL view (it's quite long) of my query:
SELECT tblToolDatasheet.Supplier, Max(tblToolDatasheet.Revision) AS
MaxOfRevision, tblToolDatasheet.[Program Type],
tblToolDatasheet.Program, tblToolDatasheet.[Unique Part],
tblToolDatasheet.[Part Number], tblToolDatasheet.[Part Description],
tblToolDatasheet.[TRR Plan], tblToolDatasheet.[TRR Actual],
tblToolDatasheet.[TRR Risk], tblToolDatasheet.[TRR NA],
tblToolDatasheet.[CRR Plan], tblToolDatasheet.[CRR Actual],
tblToolDatasheet.[CRR Risk], tblToolDatasheet.[CRR NA],
tblToolDatasheet.[CP 150 Plan], tblToolDatasheet.[CP 150 Actual],
tblToolDatasheet.[CP 150 Risk], tblToolDatasheet.[CP 150 NA],
tblToolDatasheet.[Tool Design Plan], tblToolDatasheet.[Tool Design
Actual], tblToolDatasheet.[Tool Design Risk], tblToolDatasheet.[Tool
Design NA], tblToolDatasheet.[TFMEA Plan], tblToolDatasheet.[TFMEA
Actual], tblToolDatasheet.[TFMEA Risk], tblToolDatasheet.[TFMEA NA],
tblToolDatasheet.[Mold Fill Plan], tblToolDatasheet.[Mold Fill Actual],
tblToolDatasheet.[Mold Fill Risk], tblToolDatasheet.[Mold Fill NA],
tblToolDatasheet.[Gage Concept Plan], tblToolDatasheet.[Gage Concept
Actual], tblToolDatasheet.[Gage Concept Risk], tblToolDatasheet.[Gage
Concept NA], tblToolDatasheet.[PFMEA Plan], tblToolDatasheet.[PFMEA
Actual], tblToolDatasheet.[PFMEA Risk], tblToolDatasheet.[PFMEA NA],
tblToolDatasheet.[Tool Construct Plan], tblToolDatasheet.[Tool Construct
Actual], tblToolDatasheet.[Tool Construct Risk], tblToolDatasheet.[Tool
Construct NA], tblToolDatasheet.[Gage Construct Plan],
tblToolDatasheet.[Gage Construct Actual], tblToolDatasheet.[Gage
Construct Risk], tblToolDatasheet.[Gage Construct NA],
tblToolDatasheet.[First Shots Plan], tblToolDatasheet.[First Shots
Actual], tblToolDatasheet.[First Shots Risk], tblToolDatasheet.[First
Shots NA], tblToolDatasheet.[Tool Adjustment Plan],
tblToolDatasheet.[Tool Adjustment Actual], tblToolDatasheet.[Tool
Adjustment Risk], tblToolDatasheet.[Tool Adjustment NA],
tblToolDatasheet.[Process Adjustment Plan], tblToolDatasheet.[Process
Adjustment Actual], tblToolDatasheet.[Process Adjustment Risk],
tblToolDatasheet.[Process Adjustment NA], tblToolDatasheet.[Process
Adjustment NA Reason], tblToolDatasheet.[GRR Plan],
tblToolDatasheet.[GRR Actual], tblToolDatasheet.[GRR Risk],
tblToolDatasheet.[GRR NA], tblToolDatasheet.[Inspect Tool Steel Plan],
tblToolDatasheet.[Inspect Tool Steel Actual], tblToolDatasheet.[Inspect
Tool Steel Risk], tblToolDatasheet.[Inspect Tool Steel NA],
tblToolDatasheet.[Scr DOE Plan], tblToolDatasheet.[Scr DOE Actual],
tblToolDatasheet.[Scr DOE Risk], tblToolDatasheet.[Scr DOE NA],
tblToolDatasheet.[Tool Metro Plan], tblToolDatasheet.[Tool Metro
Actual], tblToolDatasheet.[Tool Metro Risk], tblToolDatasheet.[Tool
Metro NA], tblToolDatasheet.[Tool Capability Plan],
tblToolDatasheet.[Tool Capability Actual], tblToolDatasheet.[Tool
Capability Risk], tblToolDatasheet.[Tool Capability NA],
tblToolDatasheet.[3 Way DOE Plan], tblToolDatasheet.[3 Way DOE Actual],
tblToolDatasheet.[3 Way DOE Risk], tblToolDatasheet.[3 Way DOE NA],
tblToolDatasheet.[Measuring DOE Components Plan],
tblToolDatasheet.[Measuring DOE Components Actual],
tblToolDatasheet.[Measuring DOE Components Risk],
tblToolDatasheet.[Measuring DOE Components NA], tblToolDatasheet.[DOE
Analysis Plan], tblToolDatasheet.[DOE Analysis Actual],
tblToolDatasheet.[DOE Analysis Risk], tblToolDatasheet.[DOE Analysis
NA], tblToolDatasheet.[First Art Cap St Plan], tblToolDatasheet.[First
Art Cap St Actual], tblToolDatasheet.[First Art Cap St Risk],
tblToolDatasheet.[First Art Cap St NA], tblToolDatasheet.[Control Plan
Plan], tblToolDatasheet.[Control Plan Actual], tblToolDatasheet.[Control
Plan Risk], tblToolDatasheet.[Control Plan NA], tblToolDatasheet.[EES
G10002 App Plan], tblToolDatasheet.[EES G10002 App Actual],
tblToolDatasheet.[EES G10002 App Risk], tblToolDatasheet.[EES G10002 App
NA], tblToolDatasheet.[CP 198 Plan], tblToolDatasheet.[CP 198 Actual],
tblToolDatasheet.[CP 198 Risk], tblToolDatasheet.[CP 198 NA]
FROM qryStatusReportMaxRevision INNER JOIN tblToolDatasheet ON
(qryStatusReportMaxRevision.MaxOfRevision = tblToolDatasheet.Revision)
AND (qryStatusReportMaxRevision.[Part Number] = tblToolDatasheet.[Part
Number]) AND (qryStatusReportMaxRevision.Supplier =
tblToolDatasheet.Supplier)
GROUP BY tblToolDatasheet.Supplier, tblToolDatasheet.[Program Type],
tblToolDatasheet.Program, tblToolDatasheet.[Unique Part],
tblToolDatasheet.[Part Number], tblToolDatasheet.[Part Description],
tblToolDatasheet.[TRR Plan], tblToolDatasheet.[TRR Actual],
tblToolDatasheet.[TRR Risk], tblToolDatasheet.[TRR NA],
tblToolDatasheet.[CRR Plan], tblToolDatasheet.[CRR Actual],
tblToolDatasheet.[CRR Risk], tblToolDatasheet.[CRR NA],
tblToolDatasheet.[CP 150 Plan], tblToolDatasheet.[CP 150 Actual],
tblToolDatasheet.[CP 150 Risk], tblToolDatasheet.[CP 150 NA],
tblToolDatasheet.[Tool Design Plan], tblToolDatasheet.[Tool Design
Actual], tblToolDatasheet.[Tool Design Risk], tblToolDatasheet.[Tool
Design NA], tblToolDatasheet.[TFMEA Plan], tblToolDatasheet.[TFMEA
Actual], tblToolDatasheet.[TFMEA Risk], tblToolDatasheet.[TFMEA NA],
tblToolDatasheet.[Mold Fill Plan], tblToolDatasheet.[Mold Fill Actual],
tblToolDatasheet.[Mold Fill Risk], tblToolDatasheet.[Mold Fill NA],
tblToolDatasheet.[Gage Concept Plan], tblToolDatasheet.[Gage Concept
Actual], tblToolDatasheet.[Gage Concept Risk], tblToolDatasheet.[Gage
Concept NA], tblToolDatasheet.[PFMEA Plan], tblToolDatasheet.[PFMEA
Actual], tblToolDatasheet.[PFMEA Risk], tblToolDatasheet.[PFMEA NA],
tblToolDatasheet.[Tool Construct Plan], tblToolDatasheet.[Tool Construct
Actual], tblToolDatasheet.[Tool Construct Risk], tblToolDatasheet.[Tool
Construct NA], tblToolDatasheet.[Gage Construct Plan],
tblToolDatasheet.[Gage Construct Actual], tblToolDatasheet.[Gage
Construct Risk], tblToolDatasheet.[Gage Construct NA],
tblToolDatasheet.[First Shots Plan], tblToolDatasheet.[First Shots
Actual], tblToolDatasheet.[First Shots Risk], tblToolDatasheet.[First
Shots NA], tblToolDatasheet.[Tool Adjustment Plan],
tblToolDatasheet.[Tool Adjustment Actual], tblToolDatasheet.[Tool
Adjustment Risk], tblToolDatasheet.[Tool Adjustment NA],
tblToolDatasheet.[Process Adjustment Plan], tblToolDatasheet.[Process
Adjustment Actual], tblToolDatasheet.[Process Adjustment Risk],
tblToolDatasheet.[Process Adjustment NA], tblToolDatasheet.[Process
Adjustment NA Reason], tblToolDatasheet.[GRR Plan],
tblToolDatasheet.[GRR Actual], tblToolDatasheet.[GRR Risk],
tblToolDatasheet.[GRR NA], tblToolDatasheet.[Inspect Tool Steel Plan],
tblToolDatasheet.[Inspect Tool Steel Actual], tblToolDatasheet.[Inspect
Tool Steel Risk], tblToolDatasheet.[Inspect Tool Steel NA],
tblToolDatasheet.[Scr DOE Plan], tblToolDatasheet.[Scr DOE Actual],
tblToolDatasheet.[Scr DOE Risk], tblToolDatasheet.[Scr DOE NA],
tblToolDatasheet.[Tool Metro Plan], tblToolDatasheet.[Tool Metro
Actual], tblToolDatasheet.[Tool Metro Risk], tblToolDatasheet.[Tool
Metro NA], tblToolDatasheet.[Tool Capability Plan],
tblToolDatasheet.[Tool Capability Actual], tblToolDatasheet.[Tool
Capability Risk], tblToolDatasheet.[Tool Capability NA],
tblToolDatasheet.[3 Way DOE Plan], tblToolDatasheet.[3 Way DOE Actual],
tblToolDatasheet.[3 Way DOE Risk], tblToolDatasheet.[3 Way DOE NA],
tblToolDatasheet.[Measuring DOE Components Plan],
tblToolDatasheet.[Measuring DOE Components Actual],
tblToolDatasheet.[Measuring DOE Components Risk],
tblToolDatasheet.[Measuring DOE Components NA], tblToolDatasheet.[DOE
Analysis Plan], tblToolDatasheet.[DOE Analysis Actual],
tblToolDatasheet.[DOE Analysis Risk], tblToolDatasheet.[DOE Analysis
NA], tblToolDatasheet.[First Art Cap St Plan], tblToolDatasheet.[First
Art Cap St Actual], tblToolDatasheet.[First Art Cap St Risk],
tblToolDatasheet.[First Art Cap St NA], tblToolDatasheet.[Control Plan
Plan], tblToolDatasheet.[Control Plan Actual], tblToolDatasheet.[Control
Plan Risk], tblToolDatasheet.[Control Plan NA], tblToolDatasheet.[EES
G10002 App Plan], tblToolDatasheet.[EES G10002 App Actual],
tblToolDatasheet.[EES G10002 App Risk], tblToolDatasheet.[EES G10002 App
NA], tblToolDatasheet.[CP 198 Plan], tblToolDatasheet.[CP 198 Actual],
tblToolDatasheet.[CP 198 Risk], tblToolDatasheet.[CP 198 NA]
HAVING (((tblToolDatasheet.Supplier)=[Forms]![Switchboard]![Supplier
List]) AND ((tblToolDatasheet.[Unique Part])<>"New Part"))
ORDER BY tblToolDatasheet.Supplier, Max(tblToolDatasheet.Revision),
tblToolDatasheet.[Program Type], tblToolDatasheet.Program,
tblToolDatasheet.[Unique Part];