View/Print Individual Reports

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Here is what I have:
I have a database for tracking therapy clients. Client data is in one table.
Therapy progress notes are in another with a one-to-many relationship. I have
a form w/ subform set up to receive the data. I have a query set up to tie
the two tables together and feed into a report. (Tables/Forms and Queries all
do what I want them to properly) Right now, the report contains data from
every client and progress note.

What I want is to be able to place a button on the subform for the progress
notes, so that when it is clicked it generates the report with just that
current entry instead of every single progress note in the database.
 
Steve,
You need to filter the query behind your report, by some
unique key value, that is associated with just the record you're
currently viewing on the form.
For example, a ClientID.
Your query can refer to the open form for it's criteria...
=Forms!frmClients!ClientID
Your report will now only display the Client, and therapy records
associated with that ClientID.
--
hth
Al Campagna
Microsoft Access MVP 2007-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
Friends and friends around the world.
We are presenting the new messenger.
He will be in the commissioning by the friends that we indicate to use the
system.
Access the system by clicking the link below and register free.

You get something for using orkut?
You get something for using skype?
You gain something by using twiter?
You get algumaocisa for using facebook?

Enjoy this is your time!!

Sign up and join for free.


http://www.sqipcom.com/?ref=webempreendedor

http://stakeholder.sqipcom.com/user/webempreendedor
 
I would use the command button wizard to create a button that opens the
report. Then modify the code created by the wizard so that it applies a WHERE
CONDITION in the DoCmd.OpenReport method:

Dim strWhere as String
strWhere = "[ProgNoteID]=" & Me.ProgNoteID
DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, , strWhere

This all depends on your report name as well as the primary key field and
datatype.
 
I'm entering that in the "Where condition" of the "Action arguments" section.
And keep getting the message that "Access can't parse the expression".

My primary key is "ID" the table is "Progress Notes" and the report is
"Progress Notes"

Below is how I entered the info:

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview, , strWhere

Am I putting it in the wrong place or writing it out wrong?

Thanks

Duane Hookom said:
I would use the command button wizard to create a button that opens the
report. Then modify the code created by the wizard so that it applies a WHERE
CONDITION in the DoCmd.OpenReport method:

Dim strWhere as String
strWhere = "[ProgNoteID]=" & Me.ProgNoteID
DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, , strWhere

This all depends on your report name as well as the primary key field and
datatype.
--
Duane Hookom
Microsoft Access MVP


Steve said:
Here is what I have:
I have a database for tracking therapy clients. Client data is in one table.
Therapy progress notes are in another with a one-to-many relationship. I have
a form w/ subform set up to receive the data. I have a query set up to tie
the two tables together and feed into a report. (Tables/Forms and Queries all
do what I want them to properly) Right now, the report contains data from
every client and progress note.

What I want is to be able to place a button on the subform for the progress
notes, so that when it is clicked it generates the report with just that
current entry instead of every single progress note in the database.
 
Is the ID field included in the Report's record source query?

--
Duane Hookom
Microsoft Access MVP


Steve said:
I'm entering that in the "Where condition" of the "Action arguments" section.
And keep getting the message that "Access can't parse the expression".

My primary key is "ID" the table is "Progress Notes" and the report is
"Progress Notes"

Below is how I entered the info:

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview, , strWhere

Am I putting it in the wrong place or writing it out wrong?

Thanks

Duane Hookom said:
I would use the command button wizard to create a button that opens the
report. Then modify the code created by the wizard so that it applies a WHERE
CONDITION in the DoCmd.OpenReport method:

Dim strWhere as String
strWhere = "[ProgNoteID]=" & Me.ProgNoteID
DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, , strWhere

This all depends on your report name as well as the primary key field and
datatype.
--
Duane Hookom
Microsoft Access MVP


Steve said:
Here is what I have:
I have a database for tracking therapy clients. Client data is in one table.
Therapy progress notes are in another with a one-to-many relationship. I have
a form w/ subform set up to receive the data. I have a query set up to tie
the two tables together and feed into a report. (Tables/Forms and Queries all
do what I want them to properly) Right now, the report contains data from
every client and progress note.

What I want is to be able to place a button on the subform for the progress
notes, so that when it is clicked it generates the report with just that
current entry instead of every single progress note in the database.
 
Yes it is.

Duane Hookom said:
Is the ID field included in the Report's record source query?

--
Duane Hookom
Microsoft Access MVP


Steve said:
I'm entering that in the "Where condition" of the "Action arguments" section.
And keep getting the message that "Access can't parse the expression".

My primary key is "ID" the table is "Progress Notes" and the report is
"Progress Notes"

Below is how I entered the info:

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview, , strWhere

Am I putting it in the wrong place or writing it out wrong?

Thanks

Duane Hookom said:
I would use the command button wizard to create a button that opens the
report. Then modify the code created by the wizard so that it applies a WHERE
CONDITION in the DoCmd.OpenReport method:

Dim strWhere as String
strWhere = "[ProgNoteID]=" & Me.ProgNoteID
DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, , strWhere

This all depends on your report name as well as the primary key field and
datatype.
--
Duane Hookom
Microsoft Access MVP


:

Here is what I have:
I have a database for tracking therapy clients. Client data is in one table.
Therapy progress notes are in another with a one-to-many relationship. I have
a form w/ subform set up to receive the data. I have a query set up to tie
the two tables together and feed into a report. (Tables/Forms and Queries all
do what I want them to properly) Right now, the report contains data from
every client and progress note.

What I want is to be able to place a button on the subform for the progress
notes, so that when it is clicked it generates the report with just that
current entry instead of every single progress note in the database.
 
Are you actually using code or a macro? You mention "Action arguments" but
this doesn't sound like code.

Is the ID field numeric or text?

--
Duane Hookom
Microsoft Access MVP


Steve said:
Yes it is.

Duane Hookom said:
Is the ID field included in the Report's record source query?

--
Duane Hookom
Microsoft Access MVP


Steve said:
I'm entering that in the "Where condition" of the "Action arguments" section.
And keep getting the message that "Access can't parse the expression".

My primary key is "ID" the table is "Progress Notes" and the report is
"Progress Notes"

Below is how I entered the info:

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview, , strWhere

Am I putting it in the wrong place or writing it out wrong?

Thanks

:

I would use the command button wizard to create a button that opens the
report. Then modify the code created by the wizard so that it applies a WHERE
CONDITION in the DoCmd.OpenReport method:

Dim strWhere as String
strWhere = "[ProgNoteID]=" & Me.ProgNoteID
DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, , strWhere

This all depends on your report name as well as the primary key field and
datatype.
--
Duane Hookom
Microsoft Access MVP


:

Here is what I have:
I have a database for tracking therapy clients. Client data is in one table.
Therapy progress notes are in another with a one-to-many relationship. I have
a form w/ subform set up to receive the data. I have a query set up to tie
the two tables together and feed into a report. (Tables/Forms and Queries all
do what I want them to properly) Right now, the report contains data from
every client and progress note.

What I want is to be able to place a button on the subform for the progress
notes, so that when it is clicked it generates the report with just that
current entry instead of every single progress note in the database.
 
The ID field is an autonumber generated by access.

I was trying to do this via macro. I realised what you put down there is
code, so I went at it that way, and what I get when I press the button is an
error message that says the report doesn't exsist.

Do you know of a good reference site for setting this up step by step?

Duane Hookom said:
Are you actually using code or a macro? You mention "Action arguments" but
this doesn't sound like code.

Is the ID field numeric or text?

--
Duane Hookom
Microsoft Access MVP


Steve said:
Yes it is.

Duane Hookom said:
Is the ID field included in the Report's record source query?

--
Duane Hookom
Microsoft Access MVP


:

I'm entering that in the "Where condition" of the "Action arguments" section.
And keep getting the message that "Access can't parse the expression".

My primary key is "ID" the table is "Progress Notes" and the report is
"Progress Notes"

Below is how I entered the info:

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview, , strWhere

Am I putting it in the wrong place or writing it out wrong?

Thanks

:

I would use the command button wizard to create a button that opens the
report. Then modify the code created by the wizard so that it applies a WHERE
CONDITION in the DoCmd.OpenReport method:

Dim strWhere as String
strWhere = "[ProgNoteID]=" & Me.ProgNoteID
DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, , strWhere

This all depends on your report name as well as the primary key field and
datatype.
--
Duane Hookom
Microsoft Access MVP


:

Here is what I have:
I have a database for tracking therapy clients. Client data is in one table.
Therapy progress notes are in another with a one-to-many relationship. I have
a form w/ subform set up to receive the data. I have a query set up to tie
the two tables together and feed into a report. (Tables/Forms and Queries all
do what I want them to properly) Right now, the report contains data from
every client and progress note.

What I want is to be able to place a button on the subform for the progress
notes, so that when it is clicked it generates the report with just that
current entry instead of every single progress note in the database.
 
If the error suggested the report doesn't exist, what do you have to say
about that?

--
Duane Hookom
MS Access MVP

Steve said:
The ID field is an autonumber generated by access.

I was trying to do this via macro. I realised what you put down there is
code, so I went at it that way, and what I get when I press the button is
an
error message that says the report doesn't exsist.

Do you know of a good reference site for setting this up step by step?

Duane Hookom said:
Are you actually using code or a macro? You mention "Action arguments"
but
this doesn't sound like code.

Is the ID field numeric or text?

--
Duane Hookom
Microsoft Access MVP


Steve said:
Yes it is.

:

Is the ID field included in the Report's record source query?

--
Duane Hookom
Microsoft Access MVP


:

I'm entering that in the "Where condition" of the "Action
arguments" section.
And keep getting the message that "Access can't parse the
expression".

My primary key is "ID" the table is "Progress Notes" and the report
is
"Progress Notes"

Below is how I entered the info:

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview, , strWhere

Am I putting it in the wrong place or writing it out wrong?

Thanks

:

I would use the command button wizard to create a button that
opens the
report. Then modify the code created by the wizard so that it
applies a WHERE
CONDITION in the DoCmd.OpenReport method:

Dim strWhere as String
strWhere = "[ProgNoteID]=" & Me.ProgNoteID
DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, ,
strWhere

This all depends on your report name as well as the primary key
field and
datatype.
--
Duane Hookom
Microsoft Access MVP


:

Here is what I have:
I have a database for tracking therapy clients. Client data is
in one table.
Therapy progress notes are in another with a one-to-many
relationship. I have
a form w/ subform set up to receive the data. I have a query
set up to tie
the two tables together and feed into a report. (Tables/Forms
and Queries all
do what I want them to properly) Right now, the report contains
data from
every client and progress note.

What I want is to be able to place a button on the subform for
the progress
notes, so that when it is clicked it generates the report with
just that
current entry instead of every single progress note in the
database.
 
The report is there. I can open it manually from the navigation pane. I can
create a button that opens it with every record displayed. When using the
code you supplied, I have tried the report title with and without spaces (it
has spaces the way it is written on the report itself). For some reason, I
get an error saying it doesn't exsist or that the name is misspelled (it is
not) and an option to debug. When it opens the debug screen, everything looks
like it should.

Duane Hookom said:
If the error suggested the report doesn't exist, what do you have to say
about that?

--
Duane Hookom
MS Access MVP

Steve said:
The ID field is an autonumber generated by access.

I was trying to do this via macro. I realised what you put down there is
code, so I went at it that way, and what I get when I press the button is
an
error message that says the report doesn't exsist.

Do you know of a good reference site for setting this up step by step?

Duane Hookom said:
Are you actually using code or a macro? You mention "Action arguments"
but
this doesn't sound like code.

Is the ID field numeric or text?

--
Duane Hookom
Microsoft Access MVP


:

Yes it is.

:

Is the ID field included in the Report's record source query?

--
Duane Hookom
Microsoft Access MVP


:

I'm entering that in the "Where condition" of the "Action
arguments" section.
And keep getting the message that "Access can't parse the
expression".

My primary key is "ID" the table is "Progress Notes" and the report
is
"Progress Notes"

Below is how I entered the info:

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview, , strWhere

Am I putting it in the wrong place or writing it out wrong?

Thanks

:

I would use the command button wizard to create a button that
opens the
report. Then modify the code created by the wizard so that it
applies a WHERE
CONDITION in the DoCmd.OpenReport method:

Dim strWhere as String
strWhere = "[ProgNoteID]=" & Me.ProgNoteID
DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, ,
strWhere

This all depends on your report name as well as the primary key
field and
datatype.
--
Duane Hookom
Microsoft Access MVP


:

Here is what I have:
I have a database for tracking therapy clients. Client data is
in one table.
Therapy progress notes are in another with a one-to-many
relationship. I have
a form w/ subform set up to receive the data. I have a query
set up to tie
the two tables together and feed into a report. (Tables/Forms
and Queries all
do what I want them to properly) Right now, the report contains
data from
every client and progress note.

What I want is to be able to place a button on the subform for
the progress
notes, so that when it is clicked it generates the report with
just that
current entry instead of every single progress note in the
database.
 
What happens if you remove the strWhere?

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview

--
Duane Hookom
Microsoft Access MVP


Steve said:
The report is there. I can open it manually from the navigation pane. I can
create a button that opens it with every record displayed. When using the
code you supplied, I have tried the report title with and without spaces (it
has spaces the way it is written on the report itself). For some reason, I
get an error saying it doesn't exsist or that the name is misspelled (it is
not) and an option to debug. When it opens the debug screen, everything looks
like it should.

Duane Hookom said:
If the error suggested the report doesn't exist, what do you have to say
about that?

--
Duane Hookom
MS Access MVP

Steve said:
The ID field is an autonumber generated by access.

I was trying to do this via macro. I realised what you put down there is
code, so I went at it that way, and what I get when I press the button is
an
error message that says the report doesn't exsist.

Do you know of a good reference site for setting this up step by step?

:

Are you actually using code or a macro? You mention "Action arguments"
but
this doesn't sound like code.

Is the ID field numeric or text?

--
Duane Hookom
Microsoft Access MVP


:

Yes it is.

:

Is the ID field included in the Report's record source query?

--
Duane Hookom
Microsoft Access MVP


:

I'm entering that in the "Where condition" of the "Action
arguments" section.
And keep getting the message that "Access can't parse the
expression".

My primary key is "ID" the table is "Progress Notes" and the report
is
"Progress Notes"

Below is how I entered the info:

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview, , strWhere

Am I putting it in the wrong place or writing it out wrong?

Thanks

:

I would use the command button wizard to create a button that
opens the
report. Then modify the code created by the wizard so that it
applies a WHERE
CONDITION in the DoCmd.OpenReport method:

Dim strWhere as String
strWhere = "[ProgNoteID]=" & Me.ProgNoteID
DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, ,
strWhere

This all depends on your report name as well as the primary key
field and
datatype.
--
Duane Hookom
Microsoft Access MVP


:

Here is what I have:
I have a database for tracking therapy clients. Client data is
in one table.
Therapy progress notes are in another with a one-to-many
relationship. I have
a form w/ subform set up to receive the data. I have a query
set up to tie
the two tables together and feed into a report. (Tables/Forms
and Queries all
do what I want them to properly) Right now, the report contains
data from
every client and progress note.

What I want is to be able to place a button on the subform for
the progress
notes, so that when it is clicked it generates the report with
just that
current entry instead of every single progress note in the
database.
 
If I put the whole entry:

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview

or just the last line

DoCmd.OpenReport "rptProgress Notes", acPrintPreview

I get the following when I click the button:

"Run-time error '2103'

The report name 'rptProgress Notes' you entered in either the property sheet
or macro is misspelled or refers to a report that doesn't exsist."

I'm not putting it in a macro though, I'm putting it in the code builder.

Duane Hookom said:
What happens if you remove the strWhere?

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview

--
Duane Hookom
Microsoft Access MVP


Steve said:
The report is there. I can open it manually from the navigation pane. I can
create a button that opens it with every record displayed. When using the
code you supplied, I have tried the report title with and without spaces (it
has spaces the way it is written on the report itself). For some reason, I
get an error saying it doesn't exsist or that the name is misspelled (it is
not) and an option to debug. When it opens the debug screen, everything looks
like it should.

Duane Hookom said:
If the error suggested the report doesn't exist, what do you have to say
about that?

--
Duane Hookom
MS Access MVP

The ID field is an autonumber generated by access.

I was trying to do this via macro. I realised what you put down there is
code, so I went at it that way, and what I get when I press the button is
an
error message that says the report doesn't exsist.

Do you know of a good reference site for setting this up step by step?

:

Are you actually using code or a macro? You mention "Action arguments"
but
this doesn't sound like code.

Is the ID field numeric or text?

--
Duane Hookom
Microsoft Access MVP


:

Yes it is.

:

Is the ID field included in the Report's record source query?

--
Duane Hookom
Microsoft Access MVP


:

I'm entering that in the "Where condition" of the "Action
arguments" section.
And keep getting the message that "Access can't parse the
expression".

My primary key is "ID" the table is "Progress Notes" and the report
is
"Progress Notes"

Below is how I entered the info:

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview, , strWhere

Am I putting it in the wrong place or writing it out wrong?

Thanks

:

I would use the command button wizard to create a button that
opens the
report. Then modify the code created by the wizard so that it
applies a WHERE
CONDITION in the DoCmd.OpenReport method:

Dim strWhere as String
strWhere = "[ProgNoteID]=" & Me.ProgNoteID
DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, ,
strWhere

This all depends on your report name as well as the primary key
field and
datatype.
--
Duane Hookom
Microsoft Access MVP


:

Here is what I have:
I have a database for tracking therapy clients. Client data is
in one table.
Therapy progress notes are in another with a one-to-many
relationship. I have
a form w/ subform set up to receive the data. I have a query
set up to tie
the two tables together and feed into a report. (Tables/Forms
and Queries all
do what I want them to properly) Right now, the report contains
data from
every client and progress note.

What I want is to be able to place a button on the subform for
the progress
notes, so that when it is clicked it generates the report with
just that
current entry instead of every single progress note in the
database.
 
You have spaces in the report name. That can cause problems.

Try using square brackets around the name and see if that takes care of the
problem.
DoCmd.OpenReport "[rptProgress Notes]", acPrintPreview

If that works then you can add in the strWhere to the call to OpenReport as
Duane suggested.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
If I put the whole entry:

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview

or just the last line

DoCmd.OpenReport "rptProgress Notes", acPrintPreview

I get the following when I click the button:

"Run-time error '2103'

The report name 'rptProgress Notes' you entered in either the property sheet
or macro is misspelled or refers to a report that doesn't exsist."

I'm not putting it in a macro though, I'm putting it in the code builder.

Duane Hookom said:
What happens if you remove the strWhere?

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview

--
Duane Hookom
Microsoft Access MVP


Steve said:
The report is there. I can open it manually from the navigation pane. I can
create a button that opens it with every record displayed. When using the
code you supplied, I have tried the report title with and without spaces (it
has spaces the way it is written on the report itself). For some reason, I
get an error saying it doesn't exsist or that the name is misspelled (it is
not) and an option to debug. When it opens the debug screen, everything looks
like it should.

:

If the error suggested the report doesn't exist, what do you have to say
about that?

--
Duane Hookom
MS Access MVP

The ID field is an autonumber generated by access.

I was trying to do this via macro. I realised what you put down there is
code, so I went at it that way, and what I get when I press the button is
an
error message that says the report doesn't exsist.

Do you know of a good reference site for setting this up step by step?

:

Are you actually using code or a macro? You mention "Action arguments"
but
this doesn't sound like code.

Is the ID field numeric or text?

--
Duane Hookom
Microsoft Access MVP


:

Yes it is.

:

Is the ID field included in the Report's record source query?

--
Duane Hookom
Microsoft Access MVP


:

I'm entering that in the "Where condition" of the "Action
arguments" section.
And keep getting the message that "Access can't parse the
expression".

My primary key is "ID" the table is "Progress Notes" and the report
is
"Progress Notes"

Below is how I entered the info:

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview, , strWhere

Am I putting it in the wrong place or writing it out wrong?

Thanks

:

I would use the command button wizard to create a button that
opens the
report. Then modify the code created by the wizard so that it
applies a WHERE
CONDITION in the DoCmd.OpenReport method:

Dim strWhere as String
strWhere = "[ProgNoteID]=" & Me.ProgNoteID
DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, ,
strWhere

This all depends on your report name as well as the primary key
field and
datatype.
--
Duane Hookom
Microsoft Access MVP


:

Here is what I have:
I have a database for tracking therapy clients. Client data is
in one table.
Therapy progress notes are in another with a one-to-many
relationship. I have
a form w/ subform set up to receive the data. I have a query
set up to tie
the two tables together and feed into a report. (Tables/Forms
and Queries all
do what I want them to properly) Right now, the report contains
data from
every client and progress note.

What I want is to be able to place a button on the subform for
the progress
notes, so that when it is clicked it generates the report with
just that
current entry instead of every single progress note in the
database.
 
I think Steve may have entered the code into the property rather than the
module.


--
Duane Hookom
MS Access MVP


John Spencer said:
You have spaces in the report name. That can cause problems.

Try using square brackets around the name and see if that takes care of
the problem.
DoCmd.OpenReport "[rptProgress Notes]", acPrintPreview

If that works then you can add in the strWhere to the call to OpenReport
as Duane suggested.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
If I put the whole entry:

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview

or just the last line

DoCmd.OpenReport "rptProgress Notes", acPrintPreview

I get the following when I click the button:

"Run-time error '2103'

The report name 'rptProgress Notes' you entered in either the property
sheet or macro is misspelled or refers to a report that doesn't exsist."

I'm not putting it in a macro though, I'm putting it in the code builder.

Duane Hookom said:
What happens if you remove the strWhere?

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview

--
Duane Hookom
Microsoft Access MVP


:

The report is there. I can open it manually from the navigation pane. I
can create a button that opens it with every record displayed. When
using the code you supplied, I have tried the report title with and
without spaces (it has spaces the way it is written on the report
itself). For some reason, I get an error saying it doesn't exsist or
that the name is misspelled (it is not) and an option to debug. When it
opens the debug screen, everything looks like it should.

:

If the error suggested the report doesn't exist, what do you have to
say about that?

--
Duane Hookom
MS Access MVP

The ID field is an autonumber generated by access.

I was trying to do this via macro. I realised what you put down there
is
code, so I went at it that way, and what I get when I press the
button is an
error message that says the report doesn't exsist.

Do you know of a good reference site for setting this up step by
step?

:

Are you actually using code or a macro? You mention "Action
arguments" but
this doesn't sound like code.

Is the ID field numeric or text?

--
Duane Hookom
Microsoft Access MVP


:

Yes it is.

:

Is the ID field included in the Report's record source query?

--
Duane Hookom
Microsoft Access MVP


:

I'm entering that in the "Where condition" of the "Action
arguments" section.
And keep getting the message that "Access can't parse the
expression".

My primary key is "ID" the table is "Progress Notes" and the
report is
"Progress Notes"

Below is how I entered the info:

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview, , strWhere

Am I putting it in the wrong place or writing it out wrong?

Thanks

:

I would use the command button wizard to create a button that
opens the
report. Then modify the code created by the wizard so that it
applies a WHERE
CONDITION in the DoCmd.OpenReport method:

Dim strWhere as String
strWhere = "[ProgNoteID]=" & Me.ProgNoteID
DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, ,
strWhere

This all depends on your report name as well as the primary key
field and
datatype.
--
Duane Hookom
Microsoft Access MVP


:

Here is what I have:
I have a database for tracking therapy clients. Client data is
in one table.
Therapy progress notes are in another with a one-to-many
relationship. I have
a form w/ subform set up to receive the data. I have a query
set up to tie
the two tables together and feed into a report. (Tables/Forms
and Queries all
do what I want them to properly) Right now, the report contains
data from
every client and progress note.

What I want is to be able to place a button on the subform for
the progress
notes, so that when it is clicked it generates the report with
just that
current entry instead of every single progress note in the
database.
 
Thanks for the assistance. For whatever reason, I could not get that method
to work. However, after many hours of looking through these forums, I found
the method below that worked for me, and am posting here for anyone esle with
the same issue.

DoCmd.OpenReport "Progress Notes", acViewPreview, , "[ID] = " & Me.ID

Entering that into the button's code pops up just the report with just the
record I need.

Duane Hookom said:
I think Steve may have entered the code into the property rather than the
module.


--
Duane Hookom
MS Access MVP


John Spencer said:
You have spaces in the report name. That can cause problems.

Try using square brackets around the name and see if that takes care of
the problem.
DoCmd.OpenReport "[rptProgress Notes]", acPrintPreview

If that works then you can add in the strWhere to the call to OpenReport
as Duane suggested.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
If I put the whole entry:

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview

or just the last line

DoCmd.OpenReport "rptProgress Notes", acPrintPreview

I get the following when I click the button:

"Run-time error '2103'

The report name 'rptProgress Notes' you entered in either the property
sheet or macro is misspelled or refers to a report that doesn't exsist."

I'm not putting it in a macro though, I'm putting it in the code builder.

:

What happens if you remove the strWhere?

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview

--
Duane Hookom
Microsoft Access MVP


:

The report is there. I can open it manually from the navigation pane. I
can create a button that opens it with every record displayed. When
using the code you supplied, I have tried the report title with and
without spaces (it has spaces the way it is written on the report
itself). For some reason, I get an error saying it doesn't exsist or
that the name is misspelled (it is not) and an option to debug. When it
opens the debug screen, everything looks like it should.

:

If the error suggested the report doesn't exist, what do you have to
say about that?

--
Duane Hookom
MS Access MVP

The ID field is an autonumber generated by access.

I was trying to do this via macro. I realised what you put down there
is
code, so I went at it that way, and what I get when I press the
button is an
error message that says the report doesn't exsist.

Do you know of a good reference site for setting this up step by
step?

:

Are you actually using code or a macro? You mention "Action
arguments" but
this doesn't sound like code.

Is the ID field numeric or text?

--
Duane Hookom
Microsoft Access MVP


:

Yes it is.

:

Is the ID field included in the Report's record source query?

--
Duane Hookom
Microsoft Access MVP


:

I'm entering that in the "Where condition" of the "Action
arguments" section.
And keep getting the message that "Access can't parse the
expression".

My primary key is "ID" the table is "Progress Notes" and the
report is
"Progress Notes"

Below is how I entered the info:

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview, , strWhere

Am I putting it in the wrong place or writing it out wrong?

Thanks

:

I would use the command button wizard to create a button that
opens the
report. Then modify the code created by the wizard so that it
applies a WHERE
CONDITION in the DoCmd.OpenReport method:

Dim strWhere as String
strWhere = "[ProgNoteID]=" & Me.ProgNoteID
DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, ,
strWhere

This all depends on your report name as well as the primary key
field and
datatype.
--
Duane Hookom
Microsoft Access MVP


:

Here is what I have:
I have a database for tracking therapy clients. Client data is
in one table.
Therapy progress notes are in another with a one-to-many
relationship. I have
a form w/ subform set up to receive the data. I have a query
set up to tie
the two tables together and feed into a report. (Tables/Forms
and Queries all
do what I want them to properly) Right now, the report contains
data from
every client and progress note.

What I want is to be able to place a button on the subform for
the progress
notes, so that when it is clicked it generates the report with
just that
current entry instead of every single progress note in the
database.
 
Steve,
You have to understand that until you provide an actual name, we will
suggest a name placeholder like "rptProgressNotes". This is a best guess on
my part as to what I would name a report of progress notes. If your report
doesn't have the same name, you need to understand that you must change it.

--
Duane Hookom
MS Access MVP


Steve said:
Thanks for the assistance. For whatever reason, I could not get that
method
to work. However, after many hours of looking through these forums, I
found
the method below that worked for me, and am posting here for anyone esle
with
the same issue.

DoCmd.OpenReport "Progress Notes", acViewPreview, , "[ID] = " & Me.ID

Entering that into the button's code pops up just the report with just the
record I need.

Duane Hookom said:
I think Steve may have entered the code into the property rather than the
module.


--
Duane Hookom
MS Access MVP


John Spencer said:
You have spaces in the report name. That can cause problems.

Try using square brackets around the name and see if that takes care of
the problem.
DoCmd.OpenReport "[rptProgress Notes]", acPrintPreview

If that works then you can add in the strWhere to the call to
OpenReport
as Duane suggested.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

Steve wrote:
If I put the whole entry:

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview

or just the last line

DoCmd.OpenReport "rptProgress Notes", acPrintPreview

I get the following when I click the button:

"Run-time error '2103'

The report name 'rptProgress Notes' you entered in either the property
sheet or macro is misspelled or refers to a report that doesn't
exsist."

I'm not putting it in a macro though, I'm putting it in the code
builder.

:

What happens if you remove the strWhere?

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview

--
Duane Hookom
Microsoft Access MVP


:

The report is there. I can open it manually from the navigation
pane. I
can create a button that opens it with every record displayed. When
using the code you supplied, I have tried the report title with and
without spaces (it has spaces the way it is written on the report
itself). For some reason, I get an error saying it doesn't exsist or
that the name is misspelled (it is not) and an option to debug. When
it
opens the debug screen, everything looks like it should.

:

If the error suggested the report doesn't exist, what do you have
to
say about that?

--
Duane Hookom
MS Access MVP

The ID field is an autonumber generated by access.

I was trying to do this via macro. I realised what you put down
there
is
code, so I went at it that way, and what I get when I press the
button is an
error message that says the report doesn't exsist.

Do you know of a good reference site for setting this up step by
step?

:

Are you actually using code or a macro? You mention "Action
arguments" but
this doesn't sound like code.

Is the ID field numeric or text?

--
Duane Hookom
Microsoft Access MVP


:

Yes it is.

:

Is the ID field included in the Report's record source query?

--
Duane Hookom
Microsoft Access MVP


:

I'm entering that in the "Where condition" of the "Action
arguments" section.
And keep getting the message that "Access can't parse the
expression".

My primary key is "ID" the table is "Progress Notes" and the
report is
"Progress Notes"

Below is how I entered the info:

Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptProgress Notes", acPrintPreview, ,
strWhere

Am I putting it in the wrong place or writing it out wrong?

Thanks

:

I would use the command button wizard to create a button that
opens the
report. Then modify the code created by the wizard so that it
applies a WHERE
CONDITION in the DoCmd.OpenReport method:

Dim strWhere as String
strWhere = "[ProgNoteID]=" & Me.ProgNoteID
DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, ,
strWhere

This all depends on your report name as well as the primary
key
field and
datatype.
--
Duane Hookom
Microsoft Access MVP


:

Here is what I have:
I have a database for tracking therapy clients. Client data
is
in one table.
Therapy progress notes are in another with a one-to-many
relationship. I have
a form w/ subform set up to receive the data. I have a query
set up to tie
the two tables together and feed into a report.
(Tables/Forms
and Queries all
do what I want them to properly) Right now, the report
contains
data from
every client and progress note.

What I want is to be able to place a button on the subform
for
the progress
notes, so that when it is clicked it generates the report
with
just that
current entry instead of every single progress note in the
database.
 
Back
Top