G
Guest
I have a report that prints all the records from a table.
I want to print this report on click of a button in a form.
I have the following code for OnClick event to print -
stLinkCriteria = "[CONTRACT_NO]=" & "'" & Me![CONTRACT_NO] & "'" & " and
[T_NO]= " & "'" & Me![T_NO] & "'" & " and [J_NO] = " & "'" & Me![J_NO] & "'"
& " and [PHASE_NO] = " & "'" & Me![PHASE_NO] & "'"
If IsNull([stLinkCriteria]) Then
DoCmd.OpenReport stDocName, acViewPreview, stLinkCriteria
Else
DoCmd.OpenReport stDocName, acViewPreview, stLinkCriteria
End If
(well, I will change the if condition thing later on ...)
When I click, I do get to see the report, but its shows all the pages, I
want to restrict printing to only the records I pass thru' stLinkCriteria
stated above.
I think I am not doing it correctly.
Do I have to write a query to print report with filtered records or this way
it will work.
Since I already have the report to print for all records, is it possible for
me to just specify the criteria instead of redoing the report?
Thanks for your time!
-Me
I want to print this report on click of a button in a form.
I have the following code for OnClick event to print -
stLinkCriteria = "[CONTRACT_NO]=" & "'" & Me![CONTRACT_NO] & "'" & " and
[T_NO]= " & "'" & Me![T_NO] & "'" & " and [J_NO] = " & "'" & Me![J_NO] & "'"
& " and [PHASE_NO] = " & "'" & Me![PHASE_NO] & "'"
If IsNull([stLinkCriteria]) Then
DoCmd.OpenReport stDocName, acViewPreview, stLinkCriteria
Else
DoCmd.OpenReport stDocName, acViewPreview, stLinkCriteria
End If
(well, I will change the if condition thing later on ...)
When I click, I do get to see the report, but its shows all the pages, I
want to restrict printing to only the records I pass thru' stLinkCriteria
stated above.
I think I am not doing it correctly.
Do I have to write a query to print report with filtered records or this way
it will work.
Since I already have the report to print for all records, is it possible for
me to just specify the criteria instead of redoing the report?
Thanks for your time!
-Me