How to filter report (based upon a query) from a Option box on a f

G

Guest

I used the help files to write code to filter a report (based on a query). My
result is a blank report page??? In the help files under the "Where" section
of the Help file (OpenReport Action) I added this format [fieldname] =
Forms![formname]![controlname on form]. Not sure what to add under the
Filter Section.

My Option box returns 1, 2, 3 values in the form and I want to use those
values as criteria to pull only certian records from the Report. (Currently
the report pulls all records from the qurey it is based on).

Docmd.OpenReport reportname, acViewPreview, [filtername???], [Where Condition]

Any help appriciated. I've tried using the query name in the Filter section,
 
A

Allen Browne

The FilterName is useless. Just ignore it.

To create the WhereCondition, concatenate the value of the control into a
string. This kind of thing:
Dim strWhere As String
strWhere = "[fieldname] = " & Forms![formname]![controlname on form]
Docmd.OpenReport reportname, acViewPreview, , strWhere

If you have problems, you can add:
Debug.Print strWhere
and see what comes out into the Immediate Window (Ctrl+G).
It needs to look just like the WHERE clause in a query.

If FieldName is a Text field (not a number field), it needs extra quotes
around the value, i.e.:
strWhere = "[fieldname] = """ & Forms![formname]![controlname on form] &
""""
 
D

Duane Hookom

Josh,
You are sounding more and more like a broken record advertisement for your
products. News groups are for providing _free_ support to fellow Access
developer/users.

If you have some value to contribute in a thread, please feel free to do so.
However, when an OP gets a helpful post from another developer, I feel it is
in bad taste to post an advertisement.

I would appreciate it if you would stop spamming the Access NGs with your
unsolicited promotions of your products.

--
Duane Hookom
MS Access MVP
--

jl5000 said:
Bill said:
I used the help files to write code to filter a report (based on a
query). My
result is a blank report page??? In the help files under the "Where"
section
of the Help file (OpenReport Action) I added this format [fieldname] =
Forms![formname]![controlname on form]. Not sure what to add under the
Filter Section.

My Option box returns 1, 2, 3 values in the form and I want to use those
values as criteria to pull only certian records from the Report.
(Currently
the report pulls all records from the qurey it is based on).

Docmd.OpenReport reportname, acViewPreview, [filtername???], [Where
Condition]

Any help appriciated. I've tried using the query name in the Filter
section,
 
G

Guest

Do you recall this?

You might want to look at some fixes at ACGSoft
http://ourworld.compuserve.com/homepages/attac-cg/

Lets make peace, I thought some answers to the questions could be solved
with those 3rd party tools, I do not want to make any enemies, and I'll
consider your advise,

Thanks.

Duane Hookom said:
Josh,
You are sounding more and more like a broken record advertisement for your
products. News groups are for providing _free_ support to fellow Access
developer/users.

If you have some value to contribute in a thread, please feel free to do so.
However, when an OP gets a helpful post from another developer, I feel it is
in bad taste to post an advertisement.

I would appreciate it if you would stop spamming the Access NGs with your
unsolicited promotions of your products.

--
Duane Hookom
MS Access MVP
--

jl5000 said:
Bill said:
I used the help files to write code to filter a report (based on a
query). My
result is a blank report page??? In the help files under the "Where"
section
of the Help file (OpenReport Action) I added this format [fieldname] =
Forms![formname]![controlname on form]. Not sure what to add under the
Filter Section.

My Option box returns 1, 2, 3 values in the form and I want to use those
values as criteria to pull only certian records from the Report.
(Currently
the report pulls all records from the qurey it is based on).

Docmd.OpenReport reportname, acViewPreview, [filtername???], [Where
Condition]

Any help appriciated. I've tried using the query name in the Filter
section,
 
D

Duane Hookom

I recommend both free solutions and paid solutions quite frequently. The
ACGSoft site has free tips that resolve some very specific and common graph
issues that I would rather not type entirely into a reply. Just recently,
that reply resolved a major issue at no cost to anyone.

I have also recommend FMS, TechSmith, books, etc when I felt this was
justified. I would even recommend your solutions if I had tried them and
found them to be valuable. In many cases, paying for a utility or "applet"
is much cheaper in even the short run.

In this particular thread, Allen provided a good answer which very possibly
solved the OP's issue. Your reply (this time) served to only advertise your
product. There was no other useful information. Could you imagine what these
groups would look like if every third party solution provider or contractor
programmer responded to posts with advertisements?

You have provided some useful answers in other threads and I don't mind
seeing a signature that links to your site. I would rather not see an issue
develop like the "PC Datasheet threads".

--
Duane Hookom
MS Access MVP
--

jl5000 said:
Do you recall this?

You might want to look at some fixes at ACGSoft
http://ourworld.compuserve.com/homepages/attac-cg/

Lets make peace, I thought some answers to the questions could be solved
with those 3rd party tools, I do not want to make any enemies, and I'll
consider your advise,

Thanks.

Duane Hookom said:
Josh,
You are sounding more and more like a broken record advertisement for
your
products. News groups are for providing _free_ support to fellow Access
developer/users.

If you have some value to contribute in a thread, please feel free to do
so.
However, when an OP gets a helpful post from another developer, I feel it
is
in bad taste to post an advertisement.

I would appreciate it if you would stop spamming the Access NGs with your
unsolicited promotions of your products.

--
Duane Hookom
MS Access MVP
--

jl5000 said:
:

I used the help files to write code to filter a report (based on a
query). My
result is a blank report page??? In the help files under the "Where"
section
of the Help file (OpenReport Action) I added this format [fieldname] =
Forms![formname]![controlname on form]. Not sure what to add under
the
Filter Section.

My Option box returns 1, 2, 3 values in the form and I want to use
those
values as criteria to pull only certian records from the Report.
(Currently
the report pulls all records from the qurey it is based on).

Docmd.OpenReport reportname, acViewPreview, [filtername???], [Where
Condition]

Any help appriciated. I've tried using the query name in the Filter
section,
 
G

Guest

fair enough, thank you.

Duane Hookom said:
I recommend both free solutions and paid solutions quite frequently. The
ACGSoft site has free tips that resolve some very specific and common graph
issues that I would rather not type entirely into a reply. Just recently,
that reply resolved a major issue at no cost to anyone.

I have also recommend FMS, TechSmith, books, etc when I felt this was
justified. I would even recommend your solutions if I had tried them and
found them to be valuable. In many cases, paying for a utility or "applet"
is much cheaper in even the short run.

In this particular thread, Allen provided a good answer which very possibly
solved the OP's issue. Your reply (this time) served to only advertise your
product. There was no other useful information. Could you imagine what these
groups would look like if every third party solution provider or contractor
programmer responded to posts with advertisements?

You have provided some useful answers in other threads and I don't mind
seeing a signature that links to your site. I would rather not see an issue
develop like the "PC Datasheet threads".

--
Duane Hookom
MS Access MVP
--

jl5000 said:
Do you recall this?

You might want to look at some fixes at ACGSoft
http://ourworld.compuserve.com/homepages/attac-cg/

Lets make peace, I thought some answers to the questions could be solved
with those 3rd party tools, I do not want to make any enemies, and I'll
consider your advise,

Thanks.

Duane Hookom said:
Josh,
You are sounding more and more like a broken record advertisement for
your
products. News groups are for providing _free_ support to fellow Access
developer/users.

If you have some value to contribute in a thread, please feel free to do
so.
However, when an OP gets a helpful post from another developer, I feel it
is
in bad taste to post an advertisement.

I would appreciate it if you would stop spamming the Access NGs with your
unsolicited promotions of your products.

--
Duane Hookom
MS Access MVP
--


:

I used the help files to write code to filter a report (based on a
query). My
result is a blank report page??? In the help files under the "Where"
section
of the Help file (OpenReport Action) I added this format [fieldname] =
Forms![formname]![controlname on form]. Not sure what to add under
the
Filter Section.

My Option box returns 1, 2, 3 values in the form and I want to use
those
values as criteria to pull only certian records from the Report.
(Currently
the report pulls all records from the qurey it is based on).

Docmd.OpenReport reportname, acViewPreview, [filtername???], [Where
Condition]

Any help appriciated. I've tried using the query name in the Filter
section,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top