I only have the form close if the user clicks the cancel button. I
apologize
for not being very knowledgable in VB but, can you tell me why based on
what
I asked earlier, when I enter the criteria into the dialog box and
click
the
Previewbutton, my report comes up blank. It is not pulling the info
from
my
tables. I did fix the SQL to reference the form correctly.
Thanks again.
:
Don't close the form. Try set the form to invisible.
--
Duane Hookom
MS Access MVP
Yes, I close the SupervisorRptDialog box by, a command button on the
form.
Private Sub Command10_Click()
DoCmd.Close 'Close Form
End Sub
The name "SupervisorRptDialog" is referencign the dialog form.
:
Do you close the form anywhere? What is the code in your form
"SupervisorRptDialog"?
I never use this type of code. I always have a form open to select
my
criteria and then open the report.
--
Duane Hookom
MS Access MVP
--
Well, 1st problem, the report does come up (only if I run it
through
the
Dialog box) but does not have any information in it. Not pulling
the
qry
info
I am entering in>>
2nd -The user should be clicking on the Report itself and then
the
dialog
box should appear) when you double click on the report, the
dialog
box
appears, I enter the information and click preview, then the box
closes
and
no report is ran. I know this is due to my OnOpen event proc,
which
is;
Private Sub Report_Open(Cancel As Integer)
'Open Supervisor Rpt Dialog form
DoCmd.OpenForm "SupervisorRptDialog", , , , , acDialog
'Cancel Report if User Clicked the Cancel Button
If IsLoaded("SupervisorRptDialog") = False Then Cancel = True
'Set public variable to false to indicate that the
'Open event is completed
I don't know if this matters but, the report has a subreport as
well.
Any
way, Thanks so much for your help.
:
Access queries store the parameters and the criteria as separate
items.
The
developer must keep them in synch.
You code attempts to open the same report twice. Remove one
DoCmd.OpenReport...
--
Duane Hookom
MS Access MVP
--
I have two additional questions if you don't mind.
I did make the change on this but have a question. I put the
parameters
in
the query design grid so I am curious as to why in SQL View it
was
showing
the parameters I had before. Should I always check the SQL
View?
My second question is, now that the query is complete and the
dialog
does
open when the report is selected but, the report does not come
up.
Is
this
due to my
On OnClick event procedure which is below My button is named
PreviewRpt:
Private Sub PreviewRpt_Click()
Dim SQLStatement As String
DoCmd.OpenReport "Supervisor Production Report",
acViewPreview, ,
,
,
A_DIALOG
stDocName = "Supervisor Production Report"
DoCmd.OpenReport stDocName, acPreview
Exit_PreviewRpt_Click:
Exit Sub
End Sub
Is this correct?
:
Change the query parameters to match your control names.
Make sure the form is open with values using US date format.
PARAMETERS [Forms]![SupervisorRptDialog]![Group] Text (
255 ),
[Forms]![SupervisorRptDialog]![Start Date] DateTime,
[Forms]![SupervisorRptDialog]![End Date] DateTime;
SELECT EmployeeHrs.EmpID, Agents.Group,
EmployeeHrs.DateCompleted,
EmployeeHrs.[#ofIncomingPhoneCalls],
EmployeeHrs.[#ofOutgoingPhoneCalls],
EmployeeHrs.[#ofOther SC Calls/Emails],
EmployeeHrs.HrsTrainingAgts,
EmployeeHrs.HrsClassess, EmployeeHrs.HrsMeetings,
EmployeeHrs.HrsVolunteering,
EmployeeHrs.[HrsProject/Assignment],
EmployeeHrs.HrsPhoneDuty, EmployeeHrs.HrsSeniorAgentReview,
EmployeeHrs.[HrsTOS/QMF/UeWi], EmployeeHrs.HrsReports,
EmployeeHrs.HrsAbsent,
EmployeeHrs.CorrectedAssessmentLtrs,
EmployeeHrs.ManualLtrsComposed,
EmployeeHrs.[FD'sIssued], EmployeeHrs.[4549's],
EmployeeHrs.Comments
FROM Agents INNER JOIN EmployeeHrs ON Agents.EmpID =
EmployeeHrs.EmpID
WHERE (((Agents.Group)=[Forms]![SupervisorRptDialog]![Group])
AND
((EmployeeHrs.DateCompleted) Between
[Forms]![SupervisorRptDialog]![Start
Date] And [Forms]![SupervisorRptDialog]![End Date]))
WITH OWNERACCESS OPTION;
--
Duane Hookom
MS Access MVP
--
message
Here is the SQL the report is pulling from.
PARAMETERS [Enter the Group] Text ( 255 ), [Enter the Start
Date]
DateTime,
[Enter the End Date] DateTime;
SELECT EmployeeHrs.EmpID, Agents.Group,
EmployeeHrs.DateCompleted,
EmployeeHrs.[#ofIncomingPhoneCalls],
EmployeeHrs.[#ofOutgoingPhoneCalls],
EmployeeHrs.[#ofOther SC Calls/Emails],
EmployeeHrs.HrsTrainingAgts,
EmployeeHrs.HrsClassess, EmployeeHrs.HrsMeetings,
EmployeeHrs.HrsVolunteering,
EmployeeHrs.[HrsProject/Assignment],
EmployeeHrs.HrsPhoneDuty, EmployeeHrs.HrsSeniorAgentReview,
EmployeeHrs.[HrsTOS/QMF/UeWi], EmployeeHrs.HrsReports,
EmployeeHrs.HrsAbsent,
EmployeeHrs.CorrectedAssessmentLtrs,
EmployeeHrs.ManualLtrsComposed,
EmployeeHrs.[FD'sIssued], EmployeeHrs.[4549's],
EmployeeHrs.Comments
FROM Agents INNER JOIN EmployeeHrs ON Agents.EmpID =
EmployeeHrs.EmpID
WHERE
(((Agents.Group)=[Forms]![SupervisorRptDialog]![Group])
AND
((EmployeeHrs.DateCompleted) Between
[Forms]![SupervisorRptDialog]![Start
Date] And [Forms]![SupervisorRptDialog]![End Date]))
WITH OWNERACCESS OPTION;
:
Can you provide the code and/or the SQL view of the
report's
record
source?
--
Duane Hookom
MS Access MVP
--
message
I have created a Dialog form to open when the user wants
to
run
a
report.
The
form has one drop down list, you must select from the
list.
Also,
it
has a
Begin Date and A End Date. Now I have a button that when
click
should
bring
up the report based on the criteria entered but, this is
not
working. I
have
followed all the steps based on the MS access 03 help
labeled
"creating
a
form to supply parameters to a query". I placed the
reference
in
the
row
under "Group" and the reference to the form under Date.
[Forms]![SupervisorRptDialog]![Group] example, did the
on
click
events
and
got the report to open up with no data within the
report.
Is
there a