Report of current record

  • Thread starter Thread starter Nathan Guill
  • Start date Start date
N

Nathan Guill

I have a report that I would like to print based on the current record on a
subform. When I click the print button, I get a dialog asking the to record
number. My code is as follows:

Access.DoCmd.OpenReport "QFM7513-005A", acViewPreview, , "[ToolNum] = " &
Me!txtTOOLNUM

The dialog title is "Enter Parameter Value"
The text shown is the record number

If I enter the record number into the textbox, and hit okay, the report
opens just fine, otherwise I get a OpenReport action was canceled error.

If I need to upload the objects in question (i.e. table, query, forms, ...
etc.) I can.
 
You have something bound to "Record number" in your report. The code you
show has nothing to do with the error message other than opening a report
where the error is located. This could be a bound control, sorting and
grouping, or a column in the report's record source.
 
Here is the SQL for the recordsource of the report. IF I open the report up
by itself, it returns all the records in the database (about 3200 pages).
What I want is to have a button on a form control what record to print. I
thought by using the openreport where condition, it would limit this. All
of the controls on the report are bound to a field from this recordsource.

SELECT [Tooling Records].ToolIndex, [Tooling Records].ToolNum, [Tooling
Records].Restricted, [Tooling Records].Revision, [Tooling Records].Press,
[Tooling Records].AuthName, [Tooling Records].AuthDate, ToolDims.D1,
ToolDims.D2, ToolDims.D3, ToolDims.D4, ToolDims.D5, ToolDims.D6,
ToolDims.D7, ToolDims.D8, ToolDims.D9, ToolDims.D10, IIf(([Tooling
Records].[Restricted]=True),[Tooling Records].[ToolNum]+"R",[Tooling
Records].[ToolNum]) AS Expr1
FROM [Tooling Records] INNER JOIN ToolDims ON [Tooling Records].ToolNum =
ToolDims.TOOLNUM;



I have another form that currently works and the SQL is the same except it
adds the following where statement. I am trying to change the format of the
form so that all the records are grouped based on the ToolIndex using a
subform for each record and the main form for each ToolIndex. Since I am
using a subform, this where condition won't work. I have tried to point to
the control on the subform (using
Forms!mainform!subfrom-control!Form!control) without success.

WHERE ((([Tooling Records].ToolNum)=[Forms]![frmTool]![txtTOOLNUM]));


Any suggestions would be appreciated. Thanks.

Duane Hookom said:
You have something bound to "Record number" in your report. The code you
show has nothing to do with the error message other than opening a report
where the error is located. This could be a bound control, sorting and
grouping, or a column in the report's record source.

--
Duane Hookom
MS Access MVP
--

Nathan Guill said:
I have a report that I would like to print based on the current record on a
subform. When I click the print button, I get a dialog asking the to
record
number. My code is as follows:

Access.DoCmd.OpenReport "QFM7513-005A", acViewPreview, , "[ToolNum] = "
&
Me!txtTOOLNUM

The dialog title is "Enter Parameter Value"
The text shown is the record number

If I enter the record number into the textbox, and hit okay, the report
opens just fine, otherwise I get a OpenReport action was canceled error.

If I need to upload the objects in question (i.e. table, query, forms, ....
etc.) I can.
 
I thought you had an error message that referred to "Record number". Did you
check your report for references to "Record number" or is your problem not
what you stated?

--
Duane Hookom
MS Access MVP
--

Nathan Guill said:
Here is the SQL for the recordsource of the report. IF I open the report
up
by itself, it returns all the records in the database (about 3200 pages).
What I want is to have a button on a form control what record to print. I
thought by using the openreport where condition, it would limit this. All
of the controls on the report are bound to a field from this recordsource.

SELECT [Tooling Records].ToolIndex, [Tooling Records].ToolNum, [Tooling
Records].Restricted, [Tooling Records].Revision, [Tooling Records].Press,
[Tooling Records].AuthName, [Tooling Records].AuthDate, ToolDims.D1,
ToolDims.D2, ToolDims.D3, ToolDims.D4, ToolDims.D5, ToolDims.D6,
ToolDims.D7, ToolDims.D8, ToolDims.D9, ToolDims.D10, IIf(([Tooling
Records].[Restricted]=True),[Tooling Records].[ToolNum]+"R",[Tooling
Records].[ToolNum]) AS Expr1
FROM [Tooling Records] INNER JOIN ToolDims ON [Tooling Records].ToolNum =
ToolDims.TOOLNUM;



I have another form that currently works and the SQL is the same except it
adds the following where statement. I am trying to change the format of
the
form so that all the records are grouped based on the ToolIndex using a
subform for each record and the main form for each ToolIndex. Since I am
using a subform, this where condition won't work. I have tried to point
to
the control on the subform (using
Forms!mainform!subfrom-control!Form!control) without success.

WHERE ((([Tooling Records].ToolNum)=[Forms]![frmTool]![txtTOOLNUM]));


Any suggestions would be appreciated. Thanks.

Duane Hookom said:
You have something bound to "Record number" in your report. The code you
show has nothing to do with the error message other than opening a report
where the error is located. This could be a bound control, sorting and
grouping, or a column in the report's record source.

--
Duane Hookom
MS Access MVP
--

Nathan Guill said:
I have a report that I would like to print based on the current record
on a
subform. When I click the print button, I get a dialog asking the to
record
number. My code is as follows:

Access.DoCmd.OpenReport "QFM7513-005A", acViewPreview, , "[ToolNum] = "
&
Me!txtTOOLNUM

The dialog title is "Enter Parameter Value"
The text shown is the record number

If I enter the record number into the textbox, and hit okay, the report
opens just fine, otherwise I get a OpenReport action was canceled
error.

If I need to upload the objects in question (i.e. table, query, forms, ...
etc.) I can.
 
Actually, the "Record number" is the field ToolNum. I guess I should have
either stated that. Sorry.


Duane Hookom said:
I thought you had an error message that referred to "Record number". Did you
check your report for references to "Record number" or is your problem not
what you stated?

--
Duane Hookom
MS Access MVP
--

Nathan Guill said:
Here is the SQL for the recordsource of the report. IF I open the report
up
by itself, it returns all the records in the database (about 3200 pages).
What I want is to have a button on a form control what record to print. I
thought by using the openreport where condition, it would limit this. All
of the controls on the report are bound to a field from this recordsource.

SELECT [Tooling Records].ToolIndex, [Tooling Records].ToolNum, [Tooling
Records].Restricted, [Tooling Records].Revision, [Tooling Records].Press,
[Tooling Records].AuthName, [Tooling Records].AuthDate, ToolDims.D1,
ToolDims.D2, ToolDims.D3, ToolDims.D4, ToolDims.D5, ToolDims.D6,
ToolDims.D7, ToolDims.D8, ToolDims.D9, ToolDims.D10, IIf(([Tooling
Records].[Restricted]=True),[Tooling Records].[ToolNum]+"R",[Tooling
Records].[ToolNum]) AS Expr1
FROM [Tooling Records] INNER JOIN ToolDims ON [Tooling Records].ToolNum =
ToolDims.TOOLNUM;



I have another form that currently works and the SQL is the same except it
adds the following where statement. I am trying to change the format of
the
form so that all the records are grouped based on the ToolIndex using a
subform for each record and the main form for each ToolIndex. Since I am
using a subform, this where condition won't work. I have tried to point
to
the control on the subform (using
Forms!mainform!subfrom-control!Form!control) without success.

WHERE ((([Tooling Records].ToolNum)=[Forms]![frmTool]![txtTOOLNUM]));


Any suggestions would be appreciated. Thanks.

Duane Hookom said:
You have something bound to "Record number" in your report. The code you
show has nothing to do with the error message other than opening a report
where the error is located. This could be a bound control, sorting and
grouping, or a column in the report's record source.

--
Duane Hookom
MS Access MVP
--

I have a report that I would like to print based on the current record
on a
subform. When I click the print button, I get a dialog asking the to
record
number. My code is as follows:

Access.DoCmd.OpenReport "QFM7513-005A", acViewPreview, , "[ToolNum]
=
"
&
Me!txtTOOLNUM

The dialog title is "Enter Parameter Value"
The text shown is the record number

If I enter the record number into the textbox, and hit okay, the report
opens just fine, otherwise I get a OpenReport action was canceled
error.

If I need to upload the objects in question (i.e. table, query,
forms,
...
etc.) I can.
 
Is ToolNum numeric or text? If it is text, change you code to
... "[ToolNum] = """ &Me!txtTOOLNUM & """"


--
Duane Hookom
MS Access MVP
--

Nathan Guill said:
Actually, the "Record number" is the field ToolNum. I guess I should have
either stated that. Sorry.


Duane Hookom said:
I thought you had an error message that referred to "Record number". Did you
check your report for references to "Record number" or is your problem
not
what you stated?

--
Duane Hookom
MS Access MVP
--

Nathan Guill said:
Here is the SQL for the recordsource of the report. IF I open the report
up
by itself, it returns all the records in the database (about 3200 pages).
What I want is to have a button on a form control what record to print. I
thought by using the openreport where condition, it would limit this. All
of the controls on the report are bound to a field from this recordsource.

SELECT [Tooling Records].ToolIndex, [Tooling Records].ToolNum, [Tooling
Records].Restricted, [Tooling Records].Revision, [Tooling Records].Press,
[Tooling Records].AuthName, [Tooling Records].AuthDate, ToolDims.D1,
ToolDims.D2, ToolDims.D3, ToolDims.D4, ToolDims.D5, ToolDims.D6,
ToolDims.D7, ToolDims.D8, ToolDims.D9, ToolDims.D10, IIf(([Tooling
Records].[Restricted]=True),[Tooling Records].[ToolNum]+"R",[Tooling
Records].[ToolNum]) AS Expr1
FROM [Tooling Records] INNER JOIN ToolDims ON [Tooling Records].ToolNum =
ToolDims.TOOLNUM;



I have another form that currently works and the SQL is the same except it
adds the following where statement. I am trying to change the format
of
the
form so that all the records are grouped based on the ToolIndex using a
subform for each record and the main form for each ToolIndex. Since I
am
using a subform, this where condition won't work. I have tried to
point
to
the control on the subform (using
Forms!mainform!subfrom-control!Form!control) without success.

WHERE ((([Tooling Records].ToolNum)=[Forms]![frmTool]![txtTOOLNUM]));


Any suggestions would be appreciated. Thanks.

You have something bound to "Record number" in your report. The code you
show has nothing to do with the error message other than opening a report
where the error is located. This could be a bound control, sorting and
grouping, or a column in the report's record source.

--
Duane Hookom
MS Access MVP
--

I have a report that I would like to print based on the current
record
on
a
subform. When I click the print button, I get a dialog asking the
to
record
number. My code is as follows:

Access.DoCmd.OpenReport "QFM7513-005A", acViewPreview, ,
"[ToolNum] =
"
&
Me!txtTOOLNUM

The dialog title is "Enter Parameter Value"
The text shown is the record number

If I enter the record number into the textbox, and hit okay, the report
opens just fine, otherwise I get a OpenReport action was canceled
error.

If I need to upload the objects in question (i.e. table, query, forms,
...
etc.) I can.
 
Thanks, that was it. I need to look a little more closely at var types.


Duane Hookom said:
Is ToolNum numeric or text? If it is text, change you code to
... "[ToolNum] = """ &Me!txtTOOLNUM & """"


--
Duane Hookom
MS Access MVP
--

Nathan Guill said:
Actually, the "Record number" is the field ToolNum. I guess I should have
either stated that. Sorry.


Duane Hookom said:
I thought you had an error message that referred to "Record number".
Did
you
check your report for references to "Record number" or is your problem
not
what you stated?

--
Duane Hookom
MS Access MVP
--

Here is the SQL for the recordsource of the report. IF I open the report
up
by itself, it returns all the records in the database (about 3200 pages).
What I want is to have a button on a form control what record to
print.
I
thought by using the openreport where condition, it would limit this. All
of the controls on the report are bound to a field from this recordsource.

SELECT [Tooling Records].ToolIndex, [Tooling Records].ToolNum, [Tooling
Records].Restricted, [Tooling Records].Revision, [Tooling Records].Press,
[Tooling Records].AuthName, [Tooling Records].AuthDate, ToolDims.D1,
ToolDims.D2, ToolDims.D3, ToolDims.D4, ToolDims.D5, ToolDims.D6,
ToolDims.D7, ToolDims.D8, ToolDims.D9, ToolDims.D10, IIf(([Tooling
Records].[Restricted]=True),[Tooling Records].[ToolNum]+"R",[Tooling
Records].[ToolNum]) AS Expr1
FROM [Tooling Records] INNER JOIN ToolDims ON [Tooling
Records].ToolNum
=
ToolDims.TOOLNUM;



I have another form that currently works and the SQL is the same
except
it
adds the following where statement. I am trying to change the format
of
the
form so that all the records are grouped based on the ToolIndex using a
subform for each record and the main form for each ToolIndex. Since I
am
using a subform, this where condition won't work. I have tried to
point
to
the control on the subform (using
Forms!mainform!subfrom-control!Form!control) without success.

WHERE ((([Tooling Records].ToolNum)=[Forms]![frmTool]![txtTOOLNUM]));


Any suggestions would be appreciated. Thanks.

You have something bound to "Record number" in your report. The code you
show has nothing to do with the error message other than opening a report
where the error is located. This could be a bound control, sorting and
grouping, or a column in the report's record source.

--
Duane Hookom
MS Access MVP
--

I have a report that I would like to print based on the current
record
on
a
subform. When I click the print button, I get a dialog asking the
to
record
number. My code is as follows:

Access.DoCmd.OpenReport "QFM7513-005A", acViewPreview, ,
"[ToolNum] =
"
&
Me!txtTOOLNUM

The dialog title is "Enter Parameter Value"
The text shown is the record number

If I enter the record number into the textbox, and hit okay, the report
opens just fine, otherwise I get a OpenReport action was canceled
error.

If I need to upload the objects in question (i.e. table, query, forms,
...
etc.) I can.
 
Back
Top