Help with syntax

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hello.

I am re-posting this on the VBA group (was in
the 'queries' group) with the hope that someone can help
me with the correct syntax for my problem.

--------------------------------------------------------

Thank you very much for the quick response.

I understand what you are saying, but unfortunelty, my VBA
skills leave much to be desired and I am not sure of the
correct syntax to use.

So how would I tell it, in VBA, to open
report "rptMyReport" who's control source is "qryMembers"
and to have the following criteria?

qryMembers
----------
Field: AgencyName Group
Table: Agency MainTable
Criteria: Government Transportation

Once again, thanks for your assistance.

m.
-----Original Message-----
When you launch the report using the DoCmd.OpenReport you can
pass a WHERE criteria clause. So, you could use the same query
for each one, but put something like this in the DoCmd call ...

DoCmd.OpenReport "myReport" , , , , "[CustID]=" & Me.CustID

I may have the wrong number of commas above, but you get the idea.
--

Danny J. Lesandrini
(e-mail address removed)
http://amazecreations.com/datafast


Mike said:
Hello.

I want to create a number of reports that will be based on
queries that are somewhat similar.

For example, "Report 1" will be based on a query that
shows all the records of GroupA "Report 2" will show a
certain critera of GroupA and "Report 3" will show yet
another critera of GroupA. I know that I can make 3
separate queries per group to do this, however, I have 13
separate groups, each with the option to print 3 types of
reports and I don't want to have to make 39 separate
queries.

Is there a way to have 3 reports based on 1 query but have
the criteria change for each one?

Hope this makes SOME sence.

Any assistance would be greatly appreciated.

m.
 
Not sure I am following your description of the
criteria/query below, but another option I have used in
the past is to create a form where the user would select
what report they would like to view and what group they
would like to see (via a drop down on the form) and then
they would click a button to run the report with just the
following behind it:

DoCmd.OpenReport "RptMyReport", acViewPreview

Then in your query you need to add the following to the
criteria row in any of the fields that need certain
criteria restrictions:

Like IIf([Forms]![FrmMyForm].[cboGroup]="All","*",[Forms]!
[FrmMyForm].[cboGroup])

In this example it would go in the criteria of the group
field, if the user selects "All" in the drop down on the
form, then it will show all groups on the report, but if
not and they select GroupA, then it will put "GroupA"
into the criteria and only show that group - the trick is
that whatever values you have in your drop down need to
match the values in your table.

Your basically passing in the report parameters/criteria
from the form and you do not have to know or maintain VBA
code - you can maintain your query through the design
view.

Hope this helps and is not too confusing!

-----Original Message-----
Hello.

I am re-posting this on the VBA group (was in
the 'queries' group) with the hope that someone can help
me with the correct syntax for my problem.

--------------------------------------------------------

Thank you very much for the quick response.

I understand what you are saying, but unfortunelty, my VBA
skills leave much to be desired and I am not sure of the
correct syntax to use.

So how would I tell it, in VBA, to open
report "rptMyReport" who's control source is "qryMembers"
and to have the following criteria?

qryMembers
----------
Field: AgencyName Group
Table: Agency MainTable
Criteria: Government Transportation

Once again, thanks for your assistance.

m.
-----Original Message-----
When you launch the report using the DoCmd.OpenReport
you
can
pass a WHERE criteria clause. So, you could use the
same
query
for each one, but put something like this in the DoCmd call ...

DoCmd.OpenReport "myReport" , , , , "[CustID]=" & Me.CustID

I may have the wrong number of commas above, but you
get
the idea.
--

Danny J. Lesandrini
(e-mail address removed)
http://amazecreations.com/datafast
based
have
types

.
 
This helps a lot and makes a lot more sense! Will try it.

Thanks!!

m.
-----Original Message-----
Not sure I am following your description of the
criteria/query below, but another option I have used in
the past is to create a form where the user would select
what report they would like to view and what group they
would like to see (via a drop down on the form) and then
they would click a button to run the report with just the
following behind it:

DoCmd.OpenReport "RptMyReport", acViewPreview

Then in your query you need to add the following to the
criteria row in any of the fields that need certain
criteria restrictions:

Like IIf([Forms]![FrmMyForm].[cboGroup]="All","*",[Forms]!
[FrmMyForm].[cboGroup])

In this example it would go in the criteria of the group
field, if the user selects "All" in the drop down on the
form, then it will show all groups on the report, but if
not and they select GroupA, then it will put "GroupA"
into the criteria and only show that group - the trick is
that whatever values you have in your drop down need to
match the values in your table.

Your basically passing in the report parameters/criteria
from the form and you do not have to know or maintain VBA
code - you can maintain your query through the design
view.

Hope this helps and is not too confusing!

-----Original Message-----
Hello.

I am re-posting this on the VBA group (was in
the 'queries' group) with the hope that someone can help
me with the correct syntax for my problem.

--------------------------------------------------------

Thank you very much for the quick response.

I understand what you are saying, but unfortunelty, my VBA
skills leave much to be desired and I am not sure of the
correct syntax to use.

So how would I tell it, in VBA, to open
report "rptMyReport" who's control source is "qryMembers"
and to have the following criteria?

qryMembers
----------
Field: AgencyName Group
Table: Agency MainTable
Criteria: Government Transportation

Once again, thanks for your assistance.

m.
-----Original Message-----
When you launch the report using the DoCmd.OpenReport
you
can
pass a WHERE criteria clause. So, you could use the
same
query
for each one, but put something like this in the DoCmd call ...

DoCmd.OpenReport "myReport" , , , , "[CustID]=" & Me.CustID

I may have the wrong number of commas above, but you
get
the idea.
--

Danny J. Lesandrini
(e-mail address removed)
http://amazecreations.com/datafast


Hello.

I want to create a number of reports that will be
based
on
queries that are somewhat similar.

For example, "Report 1" will be based on a query that
shows all the records of GroupA "Report 2" will show a
certain critera of GroupA and "Report 3" will show yet
another critera of GroupA. I know that I can make 3
separate queries per group to do this, however, I
have
13
separate groups, each with the option to print 3
types
of
reports and I don't want to have to make 39 separate
queries.

Is there a way to have 3 reports based on 1 query but have
the criteria change for each one?

Hope this makes SOME sence.

Any assistance would be greatly appreciated.

m.

.
.
 
Back
Top