Help Printing One Record not all

  • Thread starter Thread starter Randy
  • Start date Start date
R

Randy

I have used the below code that was suggested and the reports still
prints all the records.

What would prevent this from working that maybe I am not doing
correctly?

Is there something else I need to do.

It processes the code fine except I do not get just one record.

Insert this code in the "on click" event of your command button that
prints
your report.


Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "ReportName"
stLinkCriteria = "[TableName.FieldName]=" & Me![FieldName]
DoCmd.OpenReport stDocName, acViewNormal
 
try
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "ReportName"
stLinkCriteria = "[TableName.FieldName]=" & Me![FieldName]
DoCmd.OpenReport stDocName, acViewNormal, , strCriteria

Chris
 
Chris Reveille Mar 18, 5:47 am show options

Newsgroups: microsoft.public.access.macros
From: "Chris Reveille" <[email protected]&­gt; -
Find messages by this author
Date: Fri, 18 Mar 2005 05:47:08 -0800
Local: Fri, Mar 18 2005 5:47 am
Subject: Help Printing One Record not all

try


Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "ReportName"
stLinkCriteria = "[TableName.FieldName]=" & Me![FieldName]
DoCmd.OpenReport stDocName, acViewNormal


, , strCriteria

Chris I tried that and it still did not work

When I changed it to this

Private Sub Command69_Click()
Dim strDocName As String
Dim strLinkCriteria As String

strDocName = "MAIN CLIENT INFO"
strLinkCriteria = "MAIN CLIENT INFO.CHIP=" & Me![CHIP]

DoCmd.OpenReport strDocName, acViewPreview, , strLinkCriteria

I got the following message.............

Syntax error (missing operator in query expression '(Main Client
Info.CHIP=222222

CHIP is the field that has my case number I want to pull up the report
by............Does this tell you anything about fixing this
code????????? I am new to access and do not know code.

Any suggestions
 
Your criteria doesn't look right.
Try
strLinkCriteria = "[CHIP]=" & Me![CHIP]

Chris
-----Original Message-----

Chris Reveille Mar 18, 5:47 am show options

Newsgroups: microsoft.public.access.macros
From: "Chris Reveille"
<[email protected]&­gt; -
Find messages by this author
Date: Fri, 18 Mar 2005 05:47:08 -0800
Local: Fri, Mar 18 2005 5:47 am
Subject: Help Printing One Record not all

try


Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "ReportName"
stLinkCriteria = "[TableName.FieldName]=" & Me![FieldName]
DoCmd.OpenReport stDocName, acViewNormal


, , strCriteria

Chris I tried that and it still did not work

When I changed it to this

Private Sub Command69_Click()
Dim strDocName As String
Dim strLinkCriteria As String

strDocName = "MAIN CLIENT INFO"
strLinkCriteria = "MAIN CLIENT INFO.CHIP=" & Me![CHIP]

DoCmd.OpenReport strDocName, acViewPreview, , strLinkCriteria

I got the following message.............

Syntax error (missing operator in query expression '(Main Client
Info.CHIP=222222

CHIP is the field that has my case number I want to pull up the report
by............Does this tell you anything about fixing this
code????????? I am new to access and do not know code.

Any suggestions

.
 
Chris that works fine in pull up the report for the total number of
records but still is not just bringing up the current record in the
report.
 
Chris could be be some other setting in Access that I need to change.

I can run a query and when I go to the report it still shows all the
records even though when I ran the query and went to a datasheet it
showed the selected records??????????
 
Randy,

PMFJI... The VBA procedure you are using (note, this is not a macro) is
based on certain assumptions:
1. Your MAIN CLIENT INFO report has the CHIP field in its Record Source
(i.e. the table/query that it is based on).
2. CHIP is a numerical data type.
3. Command69 is on a form that includes the CHIP field.
4. The current record on this form is saved.

There may be other considerations as well, but in my experience if these
assumptions are correct, I would expect the report to just print with
the records relating to the CHIP of the form's current record.
 
Back
Top