The code you posted opens the report with all records.
To show records for a single employee, there is a where condition you can
use in the code like this:
DoCmd.OpenReport stDocName, acPreview, , "[EmployeeID] = " & Me.cboEmployee
& ""
Replace EmployeeID with the name of the ID field for employees and
replace cboEmployee with the name of your combo.
Jeanette Cunningham
I sent you the code for the wrong form, please see below for the correct
code. This database has plans for homes that you can purchase so what I want
to do is be able to just see each invididual plan sold when I click.
Thanks
Private Sub PreviewRpt_Click()
On Error GoTo Err_PreviewRpt_Click
Dim stDocName As String
stDocName = "Individual Plans Reports"
DoCmd.OpenReport stDocName, acPreview
Exit_PreviewRpt_Click:
Exit Sub
Err_PreviewRpt_Click:
MsgBox Err.Description
Resume Exit_PreviewRpt_Click
End Sub
> The code you posted opens the report with all records.
> To show records for a single employee, there is a where condition you can
[quoted text clipped - 49 lines]
> >> >
> >> > Thanks
BruceM - 22 Feb 2008 15:06 GMT
Jeanette's suggestion still applies. Remember that only you can see your
database, so people here do not know exactly what you mean by "each
individual plan". You are in a form, and you are clicking a button to open
a report to the record that matches some field on your form. If the linking
field is PlanID, and PlanID is a number field:
DoCmd.OpenReport stDocName, acPreview, , "[PlanID] = " & Me.PlanID & ""
If PlanID is a text field:
DoCmd.OpenReport stDocName, acPreview, , "[PlanID] = """ & Me.PlanID & """"
What you are doing here is telling Access to open a report for the record in
which PlanID matches PlanID on your form.
>I sent you the code for the wrong form, please see below for the correct
> code. This database has plans for homes that you can purchase so what I
[quoted text clipped - 79 lines]
>> >> >
>> >> > Thanks
Jeanette Cunningham - 22 Feb 2008 22:09 GMT
teelee,
For example if the combo had 2 columns
1st column was ReportID
2nd column was ReportName
When user selects a Plan report name
the combo's hidden column selects the correct ReportID
Your code wants to open the report that has the ReportID selected in the
combo
So we go
DoCmd.OpenReport stDocName, acPreview, , , "[ReportID] = " & Me.TheComboName
& ""
Replace ReportID and TheComboName with the correct names for your form.
Jeanette Cunningham
>I sent you the code for the wrong form, please see below for the correct
> code. This database has plans for homes that you can purchase so what I
[quoted text clipped - 79 lines]
>> >> >
>> >> > Thanks