Need Help Please

  • Thread starter Thread starter teelee
  • Start date Start date
T

teelee

I have my database built and I'm experiencing one problem that I can't seem
to get to the bottom of. I have a Form and on this form I have a combo box
where you would select an Individual employee to where you would only see
that individuals information on the report. But the problem I'm running into
is when I select a employee and want to view the info in a report it will not
show any info for that employee. I hope this doesn't sound to confussion, but
I'm lost with this and appreciate any assistance anyone can give.

Thanks
 
teelee,
it would help if you copied and pasted the code you have and post it back
here.
Include details of version and details about what you are trying do.

Jeanette Cunningham
 
Ok here is the code: 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
 
yes
teelee said:
Ok here is the code: 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
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

Jeanette Cunningham said:
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

teelee said:
Ok here is the code: 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
 
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.

teelee said:
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

Jeanette Cunningham said:
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

teelee said:
Ok here is the code: 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


:

teelee,
it would help if you copied and pasted the code you have and post it
back
here.
Include details of version and details about what you are trying do.

Jeanette Cunningham


I have my database built and I'm experiencing one problem that I
can't
seem
to get to the bottom of. I have a Form and on this form I have a
combo
box
where you would select an Individual employee to where you would
only
see
that individuals information on the report. But the problem I'm
running
into
is when I select a employee and want to view the info in a report it
will
not
show any info for that employee. I hope this doesn't sound to
confussion,
but
I'm lost with this and appreciate any assistance anyone can give.

Thanks
 
I'm a little confussed right now. I have this in a form and what I want to
happen is, when I will select a plan (which is a combo box) and then click on
the command button which should open the report for individual plans. I have
a comman button and a combo box on this form.

Thanks
 
I don't know if you saw what I wrote when you posted this, but have you
tried implementing the suggestion? If not, is it because you don't
understand it? If that is the case, what is the connection between the
current record on the form and the report you want to open? In other words,
you want to open a report that has something in common with the current
record on the form. What do the current record and the record in the report
have in common?
 
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

teelee said:
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

Jeanette Cunningham said:
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

teelee said:
Ok here is the code: 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


:

teelee,
it would help if you copied and pasted the code you have and post it
back
here.
Include details of version and details about what you are trying do.

Jeanette Cunningham


I have my database built and I'm experiencing one problem that I
can't
seem
to get to the bottom of. I have a Form and on this form I have a
combo
box
where you would select an Individual employee to where you would
only
see
that individuals information on the report. But the problem I'm
running
into
is when I select a employee and want to view the info in a report it
will
not
show any info for that employee. I hope this doesn't sound to
confussion,
but
I'm lost with this and appreciate any assistance anyone can give.

Thanks
 
Back
Top