Prints Twice

D

Dan @BCBS

Really thought I'd find a thread for this issue but I don't see any.
Why is it printing twice?
This is my command statement to a button as you can see I have an acProview,
acPrint and PrintOut (acPreview works fine) but when I try either of the
other two I get multiple prints? Any suggestions??

stLinkCriteria = "[ICNNO]=" & "'" & ICNNO & "'"
'DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
'DoCmd.OpenReport stDocName, acPrint, , stLinkCriteria
DoCmd.PrintOut
 
F

fredg

Really thought I'd find a thread for this issue but I don't see any.
Why is it printing twice?
This is my command statement to a button as you can see I have an acProview,
acPrint and PrintOut (acPreview works fine) but when I try either of the
other two I get multiple prints? Any suggestions??

stLinkCriteria = "[ICNNO]=" & "'" & ICNNO & "'"
'DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
'DoCmd.OpenReport stDocName, acPrint, , stLinkCriteria
DoCmd.PrintOut


Assuming your criterai is valid (i.e. [ICNNO] is a text datatype), if
all you wish to do is print the report once, all you need is:

stDocName = "SomeReport"
stLinkCriteria = "[ICNNO]='" & ICNNO & "'"
DoCmd.OpenReport stDocName, , , stLinkCriteria
 
D

Dan @BCBS

I had tried that, which made it more fustrating but I figured out why I was
getting multi prints. The Report has code in the text boxes like
IIf([CA]="IR","Comm"
So, if there were multiple records that fit this statement, they all printed.

Question: Can I somehow use the MAX statement in the below code to get the
most current record based on a date?
Something like: stLinkCriteria = "[ICNNO]=" & "'" & ICNNO &
"'","MAX[DateEntered]"



stDocName = "r_LetterAck1"

stLinkCriteria = "[ICNNO]=" & "'" & ICNNO & "'"
stLinkCriteria = "[ICNNO]='" & ICNNO & "'"

DoCmd.OpenReport stDocName, acPrint, , stLinkCriteria

Thanks



fredg said:
Really thought I'd find a thread for this issue but I don't see any.
Why is it printing twice?
This is my command statement to a button as you can see I have an acProview,
acPrint and PrintOut (acPreview works fine) but when I try either of the
other two I get multiple prints? Any suggestions??

stLinkCriteria = "[ICNNO]=" & "'" & ICNNO & "'"
'DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
'DoCmd.OpenReport stDocName, acPrint, , stLinkCriteria
DoCmd.PrintOut


Assuming your criterai is valid (i.e. [ICNNO] is a text datatype), if
all you wish to do is print the report once, all you need is:

stDocName = "SomeReport"
stLinkCriteria = "[ICNNO]='" & ICNNO & "'"
DoCmd.OpenReport stDocName, , , stLinkCriteria
 
F

fredg

I had tried that, which made it more fustrating but I figured out why I was
getting multi prints. The Report has code in the text boxes like
IIf([CA]="IR","Comm"
So, if there were multiple records that fit this statement, they all printed.

Question: Can I somehow use the MAX statement in the below code to get the
most current record based on a date?
Something like: stLinkCriteria = "[ICNNO]=" & "'" & ICNNO &
"'","MAX[DateEntered]"


stDocName = "r_LetterAck1"

stLinkCriteria = "[ICNNO]=" & "'" & ICNNO & "'"
stLinkCriteria = "[ICNNO]='" & ICNNO & "'"

DoCmd.OpenReport stDocName, acPrint, , stLinkCriteria

Thanks

fredg said:
Really thought I'd find a thread for this issue but I don't see any.
Why is it printing twice?
This is my command statement to a button as you can see I have an acProview,
acPrint and PrintOut (acPreview works fine) but when I try either of the
other two I get multiple prints? Any suggestions??

stLinkCriteria = "[ICNNO]=" & "'" & ICNNO & "'"
'DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
'DoCmd.OpenReport stDocName, acPrint, , stLinkCriteria
DoCmd.PrintOut

Assuming your criterai is valid (i.e. [ICNNO] is a text datatype), if
all you wish to do is print the report once, all you need is:

stDocName = "SomeReport"
stLinkCriteria = "[ICNNO]='" & ICNNO & "'"
DoCmd.OpenReport stDocName, , , stLinkCriteria

I assume you mean the maximum date for that [ICNNO] being displayed on
the form, not the maximum date of all the records in the table.

stLinkCriteria = "[ICNNO]='" & [ICNNO] & "' And [DateEntered] =#" &
DMax("[DateEntered]","YourTableName","[ICNNO] = '" & [ICNNO] & "'") &
"#"

DoCmd.OpenReport stDocName, , , stLinkCriteria

Replace "YourTableName" with the actual name of the table.
 
D

Dan @BCBS

Yes you are correct about the max date for that ICNNO.
But, I was still having issues making this work so I made it simpler.
I added a field for the user to just enter the date they need.

Now, I'm trying to add that date field to the equation.
I have tried to fix this in many ways adding brackets, enclosing it, etc.
What am I missing?

stLinkCriteria = "[ICNNO]=" & "'" & ICNNO & "'" And [CAdate] = ""
DoCmd.OpenReport stDocName, acPrint, , stLinkCriteria



Thanks

stLinkCriteria = "[ICNNO]='" & [ICNNO] & "' And [CAdate] = #" & _
DMax("[CAdate]", "t_LetterInPut", "[ICNNO] = '" & [ICNNO] & "'") = "#"



fredg said:
I had tried that, which made it more fustrating but I figured out why I was
getting multi prints. The Report has code in the text boxes like
IIf([CA]="IR","Comm"
So, if there were multiple records that fit this statement, they all printed.

Question: Can I somehow use the MAX statement in the below code to get the
most current record based on a date?
Something like: stLinkCriteria = "[ICNNO]=" & "'" & ICNNO &
"'","MAX[DateEntered]"


stDocName = "r_LetterAck1"

stLinkCriteria = "[ICNNO]=" & "'" & ICNNO & "'"
stLinkCriteria = "[ICNNO]='" & ICNNO & "'"

DoCmd.OpenReport stDocName, acPrint, , stLinkCriteria

Thanks

fredg said:
On Tue, 24 Jun 2008 06:53:07 -0700, Dan @BCBS wrote:

Really thought I'd find a thread for this issue but I don't see any.
Why is it printing twice?
This is my command statement to a button as you can see I have an acProview,
acPrint and PrintOut (acPreview works fine) but when I try either of the
other two I get multiple prints? Any suggestions??

stLinkCriteria = "[ICNNO]=" & "'" & ICNNO & "'"
'DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
'DoCmd.OpenReport stDocName, acPrint, , stLinkCriteria
DoCmd.PrintOut

Assuming your criterai is valid (i.e. [ICNNO] is a text datatype), if
all you wish to do is print the report once, all you need is:

stDocName = "SomeReport"
stLinkCriteria = "[ICNNO]='" & ICNNO & "'"
DoCmd.OpenReport stDocName, , , stLinkCriteria

I assume you mean the maximum date for that [ICNNO] being displayed on
the form, not the maximum date of all the records in the table.

stLinkCriteria = "[ICNNO]='" & [ICNNO] & "' And [DateEntered] =#" &
DMax("[DateEntered]","YourTableName","[ICNNO] = '" & [ICNNO] & "'") &
"#"

DoCmd.OpenReport stDocName, , , stLinkCriteria

Replace "YourTableName" with the actual name of the table.
 
D

Dan @BCBS

I should have told you the erro message I'm getting:
It is Run-Time error '13' Type Mismatch. I assume that is because ICNNO is
Text and CAdate is a date field.


stLinkCriteria = "[ICNNO]=" & "'" & ICNNO & "'" And "[CAdate]=#"
DoCmd.OpenReport stDocName, acPrint, , stLinkCriteria


Dan @BCBS said:
Yes you are correct about the max date for that ICNNO.
But, I was still having issues making this work so I made it simpler.
I added a field for the user to just enter the date they need.

Now, I'm trying to add that date field to the equation.
I have tried to fix this in many ways adding brackets, enclosing it, etc.
What am I missing?

stLinkCriteria = "[ICNNO]=" & "'" & ICNNO & "'" And [CAdate] = ""
DoCmd.OpenReport stDocName, acPrint, , stLinkCriteria



Thanks
fredg said:
I had tried that, which made it more fustrating but I figured out why I was
getting multi prints. The Report has code in the text boxes like
IIf([CA]="IR","Comm"
So, if there were multiple records that fit this statement, they all printed.

Question: Can I somehow use the MAX statement in the below code to get the
most current record based on a date?
Something like: stLinkCriteria = "[ICNNO]=" & "'" & ICNNO &
"'","MAX[DateEntered]"


stDocName = "r_LetterAck1"

stLinkCriteria = "[ICNNO]=" & "'" & ICNNO & "'"
stLinkCriteria = "[ICNNO]='" & ICNNO & "'"

DoCmd.OpenReport stDocName, acPrint, , stLinkCriteria

Thanks

:

On Tue, 24 Jun 2008 06:53:07 -0700, Dan @BCBS wrote:

Really thought I'd find a thread for this issue but I don't see any.
Why is it printing twice?
This is my command statement to a button as you can see I have an acProview,
acPrint and PrintOut (acPreview works fine) but when I try either of the
other two I get multiple prints? Any suggestions??

stLinkCriteria = "[ICNNO]=" & "'" & ICNNO & "'"
'DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
'DoCmd.OpenReport stDocName, acPrint, , stLinkCriteria
DoCmd.PrintOut

Assuming your criterai is valid (i.e. [ICNNO] is a text datatype), if
all you wish to do is print the report once, all you need is:

stDocName = "SomeReport"
stLinkCriteria = "[ICNNO]='" & ICNNO & "'"
DoCmd.OpenReport stDocName, , , stLinkCriteria

I assume you mean the maximum date for that [ICNNO] being displayed on
the form, not the maximum date of all the records in the table.

stLinkCriteria = "[ICNNO]='" & [ICNNO] & "' And [DateEntered] =#" &
DMax("[DateEntered]","YourTableName","[ICNNO] = '" & [ICNNO] & "'") &
"#"

DoCmd.OpenReport stDocName, , , stLinkCriteria

Replace "YourTableName" with the actual name of the table.
 
D

Dan @BCBS

Please disregard this string. I am no longer trying to utilize the MAX
function.

I still need some help and will be posting my question witht he subject: Two
Criteria

Thanks

Dan @BCBS said:
I should have told you the erro message I'm getting:
It is Run-Time error '13' Type Mismatch. I assume that is because ICNNO is
Text and CAdate is a date field.


stLinkCriteria = "[ICNNO]=" & "'" & ICNNO & "'" And "[CAdate]=#"
DoCmd.OpenReport stDocName, acPrint, , stLinkCriteria


Dan @BCBS said:
Yes you are correct about the max date for that ICNNO.
But, I was still having issues making this work so I made it simpler.
I added a field for the user to just enter the date they need.

Now, I'm trying to add that date field to the equation.
I have tried to fix this in many ways adding brackets, enclosing it, etc.
What am I missing?

stLinkCriteria = "[ICNNO]=" & "'" & ICNNO & "'" And [CAdate] = ""
DoCmd.OpenReport stDocName, acPrint, , stLinkCriteria



Thanks
fredg said:
On Wed, 25 Jun 2008 11:55:01 -0700, Dan @BCBS wrote:

I had tried that, which made it more fustrating but I figured out why I was
getting multi prints. The Report has code in the text boxes like
IIf([CA]="IR","Comm"
So, if there were multiple records that fit this statement, they all printed.

Question: Can I somehow use the MAX statement in the below code to get the
most current record based on a date?
Something like: stLinkCriteria = "[ICNNO]=" & "'" & ICNNO &
"'","MAX[DateEntered]"


stDocName = "r_LetterAck1"

stLinkCriteria = "[ICNNO]=" & "'" & ICNNO & "'"
stLinkCriteria = "[ICNNO]='" & ICNNO & "'"

DoCmd.OpenReport stDocName, acPrint, , stLinkCriteria

Thanks

:

On Tue, 24 Jun 2008 06:53:07 -0700, Dan @BCBS wrote:

Really thought I'd find a thread for this issue but I don't see any.
Why is it printing twice?
This is my command statement to a button as you can see I have an acProview,
acPrint and PrintOut (acPreview works fine) but when I try either of the
other two I get multiple prints? Any suggestions??

stLinkCriteria = "[ICNNO]=" & "'" & ICNNO & "'"
'DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
'DoCmd.OpenReport stDocName, acPrint, , stLinkCriteria
DoCmd.PrintOut

Assuming your criterai is valid (i.e. [ICNNO] is a text datatype), if
all you wish to do is print the report once, all you need is:

stDocName = "SomeReport"
stLinkCriteria = "[ICNNO]='" & ICNNO & "'"
DoCmd.OpenReport stDocName, , , stLinkCriteria

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail


I assume you mean the maximum date for that [ICNNO] being displayed on
the form, not the maximum date of all the records in the table.

stLinkCriteria = "[ICNNO]='" & [ICNNO] & "' And [DateEntered] =#" &
DMax("[DateEntered]","YourTableName","[ICNNO] = '" & [ICNNO] & "'") &
"#"

DoCmd.OpenReport stDocName, , , stLinkCriteria

Replace "YourTableName" with the actual name of the table.
 

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