Problems with Query in a Subform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a very simple Query that displays averages for the columns of my table.

The query, when pulled up independtly, works fine.

However, I have the query placed in a Subform inside a main form, and when it pulls up there the fields all show "#Name?"

Also note that when I pull up the Subform independently, it displays as it should.

Any help would be greatly appreciated!
 
SELECT DISTINCTROW Format(Avg(QRY_Metrics_Performance.METP_Total_Calls),"0.00") AS [Avg Of METP_Total_Calls], Format(Avg(QRY_Metrics_Performance.METP_Aprod), "0.00") AS [Avg Of METP_Aprod], Format(Avg(QRY_Metrics_Performance.METP_Percent_of_Tickets_Closed), "0.00") AS [Avg Of METP_Percent_of_Tickets_Closed], Format(Avg(QRY_Metrics_Performance.METP_Aprod_Ranking),"0.00") AS [Avg Of METP_Aprod_Ranking], Format(Avg(QRY_Metrics_Performance.METP_Total_Productivity_Ranking),"0.00") AS [Avg Of METP_Total_Productivity_Ranking], format(Avg(QRY_Metrics_Performance.METP_Valid_Quality_Codes),"0.00") AS [Avg Of METP_Valid_Quality_Codes], Format(Avg(QRY_Metrics_Performance.METP_Calls_Per_QC),"0.00") AS [Avg Of METP_Calls_Per_QC]
FROM QRY_Metrics_Performance;
 
Thanks, Kris. Is QRY_Metrics_Performance a table or a query? If it's a
query, can you also post the SQL of this one? Ta.

--
Steve Schapel, Microsoft Access MVP
SELECT DISTINCTROW
Format(Avg(QRY_Metrics_Performance.METP_Total_Calls),"0.00") AS [Avg
Of METP_Total_Calls], Format(Avg(QRY_Metrics_Performance.METP_Aprod),
"0.00") AS [Avg Of METP_Aprod],
Format(Avg(QRY_Metrics_Performance.METP_Percent_of_Tickets_Closed),
"0.00") AS [Avg Of METP_Percent_of_Tickets_Closed],
Format(Avg(QRY_Metrics_Performance.METP_Aprod_Ranking),"0.00") AS
[Avg Of METP_Aprod_Ranking],
Format(Avg(QRY_Metrics_Performance.METP_Total_Productivity_Ranking),"0.00")
AS [Avg Of METP_Total_Productivity_Ranking],
format(Avg(QRY_Metrics_Performance.METP_Valid_Quality_Codes),"0.00")
AS [Avg Of METP_Valid_Quality_Codes],
Format(Avg(QRY_Metrics_Performance.METP_Calls_Per_QC),"0.00") AS [Avg
Of METP_Calls_Per_QC] FROM QRY_Metrics_Performance;


:

Kris,

Can you please post back with the SQL view of the query? Thanks.

-- Steve Schapel, Microsoft Access MVP
 
There is QRY_Metrics_Performance.
Thx a lot for you time!

SELECT TBL_Metrics_Performance.METP_Week_End_Date, TBL_Metrics_Performance.METP_Total_Calls, TBL_Metrics_Performance.METP_Aprod, TBL_Metrics_Performance.METP_Percent_of_Tickets_Closed, TBL_Metrics_Performance.METP_Aprod_Ranking, TBL_Metrics_Performance.METP_Total_Productivity_Ranking, TBL_Metrics_Performance.METP_Valid_Quality_Codes, IIf([METP_Valid_Quality_Codes]>0,format([METP_Total_Calls]/[METP_Valid_Quality_Codes],"0.00"),0) AS METP_Calls_Per_QC
FROM TBL_Metrics_Performance;

Steve Schapel said:
Thanks, Kris. Is QRY_Metrics_Performance a table or a query? If it's a
query, can you also post the SQL of this one? Ta.

--
Steve Schapel, Microsoft Access MVP
SELECT DISTINCTROW
Format(Avg(QRY_Metrics_Performance.METP_Total_Calls),"0.00") AS [Avg
Of METP_Total_Calls], Format(Avg(QRY_Metrics_Performance.METP_Aprod),
"0.00") AS [Avg Of METP_Aprod],
Format(Avg(QRY_Metrics_Performance.METP_Percent_of_Tickets_Closed),
"0.00") AS [Avg Of METP_Percent_of_Tickets_Closed],
Format(Avg(QRY_Metrics_Performance.METP_Aprod_Ranking),"0.00") AS
[Avg Of METP_Aprod_Ranking],
Format(Avg(QRY_Metrics_Performance.METP_Total_Productivity_Ranking),"0.00")
AS [Avg Of METP_Total_Productivity_Ranking],
format(Avg(QRY_Metrics_Performance.METP_Valid_Quality_Codes),"0.00")
AS [Avg Of METP_Valid_Quality_Codes],
Format(Avg(QRY_Metrics_Performance.METP_Calls_Per_QC),"0.00") AS [Avg
Of METP_Calls_Per_QC] FROM QRY_Metrics_Performance;


:

Kris,

Can you please post back with the SQL view of the query? Thanks.

-- Steve Schapel, Microsoft Access MVP


Kris L. wrote:

I have a very simple Query that displays averages for the columns
of my table.

The query, when pulled up independtly, works fine.

However, I have the query placed in a Subform inside a main form,
and when it pulls up there the fields all show "#Name?"

Also note that when I pull up the Subform independently, it
displays as it should.

Any help would be greatly appreciated!
 
Kris,

I am very sorry, I am going to have to back out of this one. I thought
there must have been something, for example a reference to the value of
a form control, in your queries which might explain this behaviour, but
I now cannot see any reason for the problem. Maybe you should re-post
your question in a new thread, which will increase the chances that
someone else will see it. Sorry!
 
Here is info from Microsoft Knowledge Base about the #Name? error. Check to
see if any of these might be present in your subform. A common problem is
that you have a control with the same name as a field in the recordsource,
but the control is not bound to the field with the same name.


The #Name? error value means that the name that you typed as the source of
the value in the field is not valid. You may have misspelled the name, you
may have omitted the equal sign (=) before the expression, or the source
itself may have been deleted.

The following example demonstrates a missing equal sign (=) in an
expression:

ControlSource: [FirstName] & " " & [LastName]

should be

Control Source: =[FirstName] & " " & [LastName]

The following example demonstrates an invalid ControlSource property name:

ControlSource: =[FirstNam] & " " & [LastName]

should be

ControlSource: =[FirstName] & " " & [LastName]

NOTE: In Microsoft Access 2000, an incorrect reference to a field in a
subform or subreport returns #Error rather than #Name?.

Some other causes for the #Name? error value include:
A field name on the form or report that does not match the name of the field
in the underlying table.
A control name that is the same as one of the fields in the underlying
table.
An expression that is designed to calculate a sum for a control may include
a Sum() function. (You can use the Sum() function to calculate sums only for
fields, not for controls.)

--

Ken Snell
<MS ACCESS MVP>

Kris L. said:
I have a very simple Query that displays averages for the columns of my table.

The query, when pulled up independtly, works fine.

However, I have the query placed in a Subform inside a main form, and when
it pulls up there the fields all show "#Name?"
 
Ken,

Thanks for those comments. However, the critical point here is that
Kris's form displays correctly in form view, but not via a subform
control. Can you make any sense of that?
 
My next guess is that either the master or child field specified for the
main form's subform control is not correct - or is mistyped.

--

Ken Snell
<MS ACCESS MVP>

Steve Schapel said:
Ken,

Thanks for those comments. However, the critical point here is that
Kris's form displays correctly in form view, but not via a subform
control. Can you make any sense of that?

--
Steve Schapel, Microsoft Access MVP


Ken said:
Here is info from Microsoft Knowledge Base about the #Name? error. Check to
see if any of these might be present in your subform. A common problem is
that you have a control with the same name as a field in the recordsource,
but the control is not bound to the field with the same name.


The #Name? error value means that the name that you typed as the source of
the value in the field is not valid. You may have misspelled the name, you
may have omitted the equal sign (=) before the expression, or the source
itself may have been deleted.

The following example demonstrates a missing equal sign (=) in an
expression:

ControlSource: [FirstName] & " " & [LastName]

should be

Control Source: =[FirstName] & " " & [LastName]

The following example demonstrates an invalid ControlSource property name:

ControlSource: =[FirstNam] & " " & [LastName]

should be

ControlSource: =[FirstName] & " " & [LastName]

NOTE: In Microsoft Access 2000, an incorrect reference to a field in a
subform or subreport returns #Error rather than #Name?.

Some other causes for the #Name? error value include:
A field name on the form or report that does not match the name of the field
in the underlying table.
A control name that is the same as one of the fields in the underlying
table.
An expression that is designed to calculate a sum for a control may include
a Sum() function. (You can use the Sum() function to calculate sums only for
fields, not for controls.)
 
Thanks for both of your comments.

As Steve said, the query displays perfectly in the normal query view, and it displays perfectly when I pull it up as an independent Sub Form.
The only time it does not pull up correctly is when I pull up the main form which displays the sub form.

I will check into the control names, and might even try deleting the subform and re-adding it as this would seem to clear up any problems associated with mis-typing a name of a control.

I will keep you apprised.

Thx again,
Kris

Ken Snell said:
My next guess is that either the master or child field specified for the
main form's subform control is not correct - or is mistyped.

--

Ken Snell
<MS ACCESS MVP>

Steve Schapel said:
Ken,

Thanks for those comments. However, the critical point here is that
Kris's form displays correctly in form view, but not via a subform
control. Can you make any sense of that?

--
Steve Schapel, Microsoft Access MVP


Ken said:
Here is info from Microsoft Knowledge Base about the #Name? error. Check to
see if any of these might be present in your subform. A common problem is
that you have a control with the same name as a field in the recordsource,
but the control is not bound to the field with the same name.


The #Name? error value means that the name that you typed as the source of
the value in the field is not valid. You may have misspelled the name, you
may have omitted the equal sign (=) before the expression, or the source
itself may have been deleted.

The following example demonstrates a missing equal sign (=) in an
expression:

ControlSource: [FirstName] & " " & [LastName]

should be

Control Source: =[FirstName] & " " & [LastName]

The following example demonstrates an invalid ControlSource property name:

ControlSource: =[FirstNam] & " " & [LastName]

should be

ControlSource: =[FirstName] & " " & [LastName]

NOTE: In Microsoft Access 2000, an incorrect reference to a field in a
subform or subreport returns #Error rather than #Name?.

Some other causes for the #Name? error value include:
A field name on the form or report that does not match the name of the field
in the underlying table.
A control name that is the same as one of the fields in the underlying
table.
An expression that is designed to calculate a sum for a control may include
a Sum() function. (You can use the Sum() function to calculate sums only for
fields, not for controls.)
 
No worries, issue is resolved.

Thanks for the effort! :)

Steve Schapel said:
Kris,

I am very sorry, I am going to have to back out of this one. I thought
there must have been something, for example a reference to the value of
a form control, in your queries which might explain this behaviour, but
I now cannot see any reason for the problem. Maybe you should re-post
your question in a new thread, which will increase the chances that
someone else will see it. Sorry!

--
Steve Schapel, Microsoft Access MVP

There is QRY_Metrics_Performance.
Thx a lot for you time!

SELECT TBL_Metrics_Performance.METP_Week_End_Date, TBL_Metrics_Performance.METP_Total_Calls, TBL_Metrics_Performance.METP_Aprod, TBL_Metrics_Performance.METP_Percent_of_Tickets_Closed, TBL_Metrics_Performance.METP_Aprod_Ranking, TBL_Metrics_Performance.METP_Total_Productivity_Ranking, TBL_Metrics_Performance.METP_Valid_Quality_Codes, IIf([METP_Valid_Quality_Codes]>0,format([METP_Total_Calls]/[METP_Valid_Quality_Codes],"0.00"),0) AS METP_Calls_Per_QC
FROM TBL_Metrics_Performance;

:
 
Update: Issue Resolved!

I ended up deleting and recreating the subform.
I believe this issue may have stemmed from a problem I had with autocorrect being turned on recently in this same form.
I had turned Autocorrect off, which resolved that issue, and I had not tried recreating the subform yet.

Anyway, I recreated the subform and it works beautifully now.

Thank you gentlemen for helping me down the right path :).


Kris L. said:
Thanks for both of your comments.

As Steve said, the query displays perfectly in the normal query view, and it displays perfectly when I pull it up as an independent Sub Form.
The only time it does not pull up correctly is when I pull up the main form which displays the sub form.

I will check into the control names, and might even try deleting the subform and re-adding it as this would seem to clear up any problems associated with mis-typing a name of a control.

I will keep you apprised.

Thx again,
Kris

Ken Snell said:
My next guess is that either the master or child field specified for the
main form's subform control is not correct - or is mistyped.

--

Ken Snell
<MS ACCESS MVP>

Steve Schapel said:
Ken,

Thanks for those comments. However, the critical point here is that
Kris's form displays correctly in form view, but not via a subform
control. Can you make any sense of that?

--
Steve Schapel, Microsoft Access MVP


Ken Snell wrote:
Here is info from Microsoft Knowledge Base about the #Name? error. Check to
see if any of these might be present in your subform. A common problem is
that you have a control with the same name as a field in the recordsource,
but the control is not bound to the field with the same name.


The #Name? error value means that the name that you typed as the source of
the value in the field is not valid. You may have misspelled the name, you
may have omitted the equal sign (=) before the expression, or the source
itself may have been deleted.

The following example demonstrates a missing equal sign (=) in an
expression:

ControlSource: [FirstName] & " " & [LastName]

should be

Control Source: =[FirstName] & " " & [LastName]

The following example demonstrates an invalid ControlSource property name:

ControlSource: =[FirstNam] & " " & [LastName]

should be

ControlSource: =[FirstName] & " " & [LastName]

NOTE: In Microsoft Access 2000, an incorrect reference to a field in a
subform or subreport returns #Error rather than #Name?.

Some other causes for the #Name? error value include:
A field name on the form or report that does not match the name of the field
in the underlying table.
A control name that is the same as one of the fields in the underlying
table.
An expression that is designed to calculate a sum for a control may include
a Sum() function. (You can use the Sum() function to calculate sums only for
fields, not for controls.)
 
Kris,

Very pleased to hear of this mysterious resolution to a mysterious problem!

--
Steve Schapel, Microsoft Access MVP
Update: Issue Resolved!

I ended up deleting and recreating the subform.
I believe this issue may have stemmed from a problem I had with autocorrect being turned on recently in this same form.
I had turned Autocorrect off, which resolved that issue, and I had not tried recreating the subform yet.

Anyway, I recreated the subform and it works beautifully now.

Thank you gentlemen for helping me down the right path :).


:

Thanks for both of your comments.

As Steve said, the query displays perfectly in the normal query view, and it displays perfectly when I pull it up as an independent Sub Form.
The only time it does not pull up correctly is when I pull up the main form which displays the sub form.

I will check into the control names, and might even try deleting the subform and re-adding it as this would seem to clear up any problems associated with mis-typing a name of a control.

I will keep you apprised.

Thx again,
Kris

:

My next guess is that either the master or child field specified for the
main form's subform control is not correct - or is mistyped.

--

Ken Snell
<MS ACCESS MVP>


Ken,

Thanks for those comments. However, the critical point here is that
Kris's form displays correctly in form view, but not via a subform
control. Can you make any sense of that?

--
Steve Schapel, Microsoft Access MVP


Ken Snell wrote:

Here is info from Microsoft Knowledge Base about the #Name? error. Check

to

see if any of these might be present in your subform. A common problem

is

that you have a control with the same name as a field in the

recordsource,

but the control is not bound to the field with the same name.


The #Name? error value means that the name that you typed as the source

of

the value in the field is not valid. You may have misspelled the name,

you

may have omitted the equal sign (=) before the expression, or the source
itself may have been deleted.

The following example demonstrates a missing equal sign (=) in an
expression:

ControlSource: [FirstName] & " " & [LastName]

should be

Control Source: =[FirstName] & " " & [LastName]

The following example demonstrates an invalid ControlSource property

name:

ControlSource: =[FirstNam] & " " & [LastName]

should be

ControlSource: =[FirstName] & " " & [LastName]

NOTE: In Microsoft Access 2000, an incorrect reference to a field in a
subform or subreport returns #Error rather than #Name?.

Some other causes for the #Name? error value include:
A field name on the form or report that does not match the name of the

field

in the underlying table.
A control name that is the same as one of the fields in the underlying
table.
An expression that is designed to calculate a sum for a control may

include

a Sum() function. (You can use the Sum() function to calculate sums only

for

fields, not for controls.)
 
Back
Top