You would add code for a "where" clause
Private Sub Print10b_Click()
On Error GoTo Err_Print10b_Click
Dim strWhere as String
Dim stDocName As String
strWhere = "[NumericID]=" & Me.txtNumericID
stDocName = "10bConfirmation"
DoCmd.OpenReport stDocName, acNormal, , strWhere
DoCmd.OpenReport stDocName, acNormal, , strWhere
Exit_Print10b_Click:
Exit Sub
Err_Print10b_Click:
MsgBox Err.Description
Resume Exit_Print10b_Click
End Sub
--
Duane Hookom
MS Access MVP
"A Moloney" <(E-Mail Removed)> wrote in message
news:8d0201c49670$f3ccdf10$(E-Mail Removed)...
> Hi
> I have the below code that runs off a command button on
> my form. It prints two copies of the report which is fine
> but it is actually applying itself to each record so when
> i select the command it prints this report for every
> record. Is there any way to specify that the report only
> prints based on the current/selected record that is in
> view?
> any help appreciated.
>
> Private Sub Print10b_Click()
> On Error GoTo Err_Print10b_Click
>
> Dim stDocName As String
>
> stDocName = "10bConfirmation"
> DoCmd.OpenReport stDocName, acNormal, , strWhere
> DoCmd.OpenReport stDocName, acNormal, , strWhere
>
>
> Exit_Print10b_Click:
> Exit Sub
>
> Err_Print10b_Click:
> MsgBox Err.Description
> Resume Exit_Print10b_Click
>
> End Sub
|