Referring to control on subform

S

Seth

Text box on sub form is displaying “#Name?â€

On my main form frmTestRprts, I have a subform (continuos view)

Name: subTestRprtStds
Source Object: fsubTestRprtStds

fsubTestRprtStds has two text box controls

txtStd ( bound to table )
txtStdRefNum ( Control Source =[qryStd]![fldStdRefNum] )

The WHERE clause of Query qryStd refers to txtStd.

The query works as intended if I run it without the forms open and enter the
value manually. But when I try and refer to txtStd on the subform text box
txtStdRefNum dispays “#Name?â€

SELECT tblStdAmds.fldStdID, tblStdAmds.fldStdRefNum,
tblStdAmds.fldStdIssueDate, tblStdAmds.fldStdAmd
FROM tblStdAmds
WHERE
(((tblStdAmds.fldStdID)=[Forms]![frmTestRprts]![subTestRprtStds].[Forms]![txtStd]));



Thanks for any help.
Seth
 
K

Ken Snell [MVP]

Change the WHERE clause to this:

WHERE
(((tblStdAmds.fldStdID)=[Forms]![frmTestRprts]![subTestRprtStds].[Form]![txtStd]));
 
S

Seth

Thanks Ken. With the change you suggested I can now run my query from the
database window, and If the main form is open the query will grab the input
it requires. So the syntax must now be correct.

But I still have "#Name?" in the sub form.

Do I have do do a refresh or requery somewhere? Have tried Records|Refresh
but no luck.

Cheers,
Seth

Ken Snell said:
Change the WHERE clause to this:

WHERE
(((tblStdAmds.fldStdID)=[Forms]![frmTestRprts]![subTestRprtStds].[Form]![txtStd]));

--

Ken Snell
<MS ACCESS MVP>


Seth said:
Text box on sub form is displaying "#Name?"

On my main form frmTestRprts, I have a subform (continuos view)

Name: subTestRprtStds
Source Object: fsubTestRprtStds

fsubTestRprtStds has two text box controls

txtStd ( bound to table )
txtStdRefNum ( Control Source =[qryStd]![fldStdRefNum] )

The WHERE clause of Query qryStd refers to txtStd.

The query works as intended if I run it without the forms open and enter
the
value manually. But when I try and refer to txtStd on the subform text box
txtStdRefNum dispays "#Name?"

SELECT tblStdAmds.fldStdID, tblStdAmds.fldStdRefNum,
tblStdAmds.fldStdIssueDate, tblStdAmds.fldStdAmd
FROM tblStdAmds
WHERE
(((tblStdAmds.fldStdID)=[Forms]![frmTestRprts]![subTestRprtStds].[Forms]![txtStd]));



Thanks for any help.
Seth
 
K

Ken Snell [MVP]

#Name error means that ACCESS is not sure which field/control you mean for
the Control Source in that textbox. What is the Control Souce for that
textbox?

If it's a field, be sure that it's one that is in the subform's
recordsource.

If it's an expression, be sure that it is not using the name of a field or
control that is not in the subform. If it's an expression, be sure that it's
not using the name of that textbox in the expression.

Do you have a field and control named the same, and is that control not
bound to that field?

Do you have a field or control named the same as one of the reserved words
in ACCESS? See these Knowledge Base articles for more information:

List of reserved words in Access 2002 and Access 2003
http://support.microsoft.com/default.aspx?scid=kb;en-us;286335

List of Microsoft Jet 4.0 reserved words
http://support.microsoft.com/?id=321266

Special characters that you must avoid when you work with Access databases
http://support.microsoft.com/?id=826763

--

Ken Snell
<MS ACCESS MVP>





Seth said:
Thanks Ken. With the change you suggested I can now run my query from the
database window, and If the main form is open the query will grab the
input
it requires. So the syntax must now be correct.

But I still have "#Name?" in the sub form.

Do I have do do a refresh or requery somewhere? Have tried Records|Refresh
but no luck.

Cheers,
Seth

Ken Snell said:
Change the WHERE clause to this:

WHERE
(((tblStdAmds.fldStdID)=[Forms]![frmTestRprts]![subTestRprtStds].[Form]![txtStd]));

--

Ken Snell
<MS ACCESS MVP>


Seth said:
Text box on sub form is displaying "#Name?"

On my main form frmTestRprts, I have a subform (continuos view)

Name: subTestRprtStds
Source Object: fsubTestRprtStds

fsubTestRprtStds has two text box controls

txtStd ( bound to table )
txtStdRefNum ( Control Source =[qryStd]![fldStdRefNum] )

The WHERE clause of Query qryStd refers to txtStd.

The query works as intended if I run it without the forms open and
enter
the
value manually. But when I try and refer to txtStd on the subform text
box
txtStdRefNum dispays "#Name?"

SELECT tblStdAmds.fldStdID, tblStdAmds.fldStdRefNum,
tblStdAmds.fldStdIssueDate, tblStdAmds.fldStdAmd
FROM tblStdAmds
WHERE
(((tblStdAmds.fldStdID)=[Forms]![frmTestRprts]![subTestRprtStds].[Forms]![txtStd]));



Thanks for any help.
Seth
 
S

Seth

Thanks Ken. Got it sorted.

Seth

Ken Snell said:
#Name error means that ACCESS is not sure which field/control you mean for
the Control Source in that textbox. What is the Control Souce for that
textbox?

If it's a field, be sure that it's one that is in the subform's
recordsource.

If it's an expression, be sure that it is not using the name of a field or
control that is not in the subform. If it's an expression, be sure that it's
not using the name of that textbox in the expression.

Do you have a field and control named the same, and is that control not
bound to that field?

Do you have a field or control named the same as one of the reserved words
in ACCESS? See these Knowledge Base articles for more information:

List of reserved words in Access 2002 and Access 2003
http://support.microsoft.com/default.aspx?scid=kb;en-us;286335

List of Microsoft Jet 4.0 reserved words
http://support.microsoft.com/?id=321266

Special characters that you must avoid when you work with Access databases
http://support.microsoft.com/?id=826763

--

Ken Snell
<MS ACCESS MVP>





Seth said:
Thanks Ken. With the change you suggested I can now run my query from the
database window, and If the main form is open the query will grab the
input
it requires. So the syntax must now be correct.

But I still have "#Name?" in the sub form.

Do I have do do a refresh or requery somewhere? Have tried Records|Refresh
but no luck.

Cheers,
Seth

Ken Snell said:
Change the WHERE clause to this:

WHERE
(((tblStdAmds.fldStdID)=[Forms]![frmTestRprts]![subTestRprtStds].[Form]![txtStd]));

--

Ken Snell
<MS ACCESS MVP>


Text box on sub form is displaying "#Name?"

On my main form frmTestRprts, I have a subform (continuos view)

Name: subTestRprtStds
Source Object: fsubTestRprtStds

fsubTestRprtStds has two text box controls

txtStd ( bound to table )
txtStdRefNum ( Control Source =[qryStd]![fldStdRefNum] )

The WHERE clause of Query qryStd refers to txtStd.

The query works as intended if I run it without the forms open and
enter
the
value manually. But when I try and refer to txtStd on the subform text
box
txtStdRefNum dispays "#Name?"

SELECT tblStdAmds.fldStdID, tblStdAmds.fldStdRefNum,
tblStdAmds.fldStdIssueDate, tblStdAmds.fldStdAmd
FROM tblStdAmds
WHERE
(((tblStdAmds.fldStdID)=[Forms]![frmTestRprts]![subTestRprtStds].[Forms]![txtStd]));



Thanks for any help.
Seth
 
Top