Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dmax Function Printing Problem

Status
Not open for further replies.

awl

IS-IT--Management
Aug 2, 2001
136
US
I have a Printing Problem in the DMax field of a Report. In my Report Header I have a text box [Updated Date] with a DMax formula: =DMax("[DateCompleted]","qryIndEmployeeCompDelReq","[EmployeeID]=[Forms]![frmSelect Individual Name Trng Recd]![cboEmployeeID]"). When I open the Report using the Form, the date is displayed when viewed on the Screen, Short Date format: 5/22/2003. No problem. However, if there are two pages on the report, the 1st page displays the date correctly, the 2nd page displays #Error in that field. And when I print the report, the date field on both pages display an #Error. There is no conditional formatting for this field. I have used and printed this report many times with no problems previously. This problem just started Monday, 10-27-03.

Note: I have a separate database consisting of minimal objects of the database above, that has the same Report format and DMax function, the control source slightly different and it works fine, even when printed using the same computer/printer as above. =DMax("[DateCompleted]","qryIndEmployeeCompDelReq","[EmployeeID]=[Forms]![frmReports]![txtEmployeeID]"). I have imported the same report into the database above, changed the two items. Again, on the Screen it is fine, when printed the #Error still persists. Could there be something hidden in the VBA codes, if so, what would I look for? Any help would be appreciated.
 
If the DateCompleted value is displayed in the report someplace (in the detail section) then I would not use DMax(). Are you closing frmReports immediately after opening the report? You could try:
=DMax("[DateCompleted]","qryIndEmployeeCompDelReq","[EmployeeID]=" & [Forms]![frmReports]![txtEmployeeID])
Is qryIndEmployeeCompDelReq the record source of the report?


Duane
MS Access MVP
 
Duane: Thanks for your response. Yes, I close frmSelect Individual Name Trng Recd immediately after opening up the rptIndEmployeeCompDelReq. I had a Close action on the macro that opens the report. So I deleted the Close action. The date shows properly on the screen, plus when the report is printed or e-mailed as a Snapshot. A) It works if I do not close the Pop Up frmSelect Individual Name Trng Recd once the report opens up. Once the report opens, I do a print and then close the Pop Up form; the date appears correctly. B) However, if I close the Pop Up form first when the report opens and then do a print, I will get the #Error again on the printed copy or Snapshot copy.

Yes, the qryIndEmployeeCompDelReq is the record source for the report. I have used your formula sample and instead of the #Error in B above, the #Name? appears when the report is printed. The date will appear properly if I follow A above. The problem is that I have to be careful when to close the Pop Up form which shouldn’t have to be.

The two macros that I have for the “On Click” of the two Command Buttons on the frmIndEmployeeCompDelReq are:
macPreview rptEmployeeCompDelReq
macClose frmSelect Individual Name Trng Recd

Curtis
 
The form must stay open until the report closes if you anticipate using the reference to the form in your report.

I would try use the following in place of the dmax():
=Max([DateCompleted])


Duane
MS Access MVP
 
Duane: Thanks again. However, I got the #Error reading on the report with the new change in the formula. So I reverted back to the DMax formula and am keeping the form open. I am not sure why this is happening now, and not prior to 10-27-2003? Thanks for your help.... Curtis...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top