Help with printing one name on a report

  • Thread starter Thread starter Bob V
  • Start date Start date
B

Bob V

On my Form that has No Record Source I have a Combo Box [cmbHorsePlanner]
that has a row source
SELECT qryHorseNameActive.HorseID, qryHorseNameActive.Name FROM
qryHorseNameActive;
And next to that Combo Box I have a Print control that prints my form that I
only want the one name that I select from my Combo Box
My Report is rptHorsePlanner, I suppose I will need a requery or Dirty so I
can change selections to print a Report!
Thanks for any Help...........Bob
 
Bob,

What is the Record Source of the report. Assuming your report is based
on a query, then I think all you will need to do is put a reference to
the combobox in the query, in the Criteria of the HorseID field,
something like this:
[Forms]![NameOfYourForm]![cmbHorsePlanner]
 
On my Form that has No Record Source I have a Combo Box [cmbHorsePlanner]
that has a row source
SELECT qryHorseNameActive.HorseID, qryHorseNameActive.Name FROM
qryHorseNameActive;
And next to that Combo Box I have a Print control that prints my form that I
only want the one name that I select from my Combo Box
My Report is rptHorsePlanner, I suppose I will need a requery or Dirty so I
can change selections to print a Report!
Thanks for any Help...........Bob

Are you printing a Report (good) or a Form (less good)?
Is the "Print control" a command button or something else?
If it's a command button please post the VBA code in its Click event - it's
easy to include a WhereCondition to print just the selected ID.

John W. Vinson [MVP]
 
Thanks figured it out
Private Sub cmdHorsePlanner_Click()
On Error GoTo Err_Command12_Click

Dim stDocName As String
Me.Dirty = False

DoCmd.OpenReport "rptMonthPlanner", acViewPreview, ,
"[qryHorseNameActive.HorseID]=Forms!frmHorseCentre!HorseID"


Exit_Command12_Click:
Exit Sub

Err_Command12_Click:
MsgBox Err.Description
Resume Exit_Command12_Click

End Sub

Thanks Bob

John W. Vinson said:
On my Form that has No Record Source I have a Combo Box [cmbHorsePlanner]
that has a row source
SELECT qryHorseNameActive.HorseID, qryHorseNameActive.Name FROM
qryHorseNameActive;
And next to that Combo Box I have a Print control that prints my form that
I
only want the one name that I select from my Combo Box
My Report is rptHorsePlanner, I suppose I will need a requery or Dirty so
I
can change selections to print a Report!
Thanks for any Help...........Bob

Are you printing a Report (good) or a Form (less good)?
Is the "Print control" a command button or something else?
If it's a command button please post the VBA code in its Click event -
it's
easy to include a WhereCondition to print just the selected ID.

John W. Vinson [MVP]
 
Back
Top