Full Version: "The expression is typed incorrectly"
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
swmagic
Ok what an exciting adventure


A report is called from frmFacultyBudgetReport. This form has parms that are passed to the report.

Whe the form is called from the main menum, it all works great because I can print from the toolbar Print icon (the desired outcome).

- The event procedure for form is
stDocName = "rptFacultyBudgetReport_A"
DoCmd.OpenReport stDocName, acPreview
- The modal and popup are both No


But when the report is called from an intermediate Data Entry screen, things go awry.

Here's the sequence
--Main Menu which calls
--frmX (cbo year selection) which calls
--Data Entry screen, which calls
--frmFacultyBudgetReport (as above) which calls
--rptFacultyBudgetReportA (as above)


The frmx Event Procedure:
--stDocName = "frmFacultyBudgetHeader"
--DoCmd.OpenForm stDocName, , , stLinkCriteria

The Data Entry Screen Printer Icon Event Procedure:
--stDocName = "frmFacultyBudgetReport"
--DoCmd.OpenForm stDocName, acNormal, , , , acDialog
--DoCmd.Close acForm, stDocName

(A) The frmFacultyBudgetReport Event Procedure is same as shown at the top:
--stDocName = "rptFacultyBudgetReport_A"
--DoCmd.OpenReport stDocName, acPreview


Here's what happens:
--The report is displayed but behind the frmFacultyBudgetReport
--The user cannot click on the report at all.


So taking the hint about closing frmFacultyBudgetReport above, I added the following right after the open in (A)
--stDocName = "frmFacultyBudgetReport"
(B) DoCmd.Close acForm, stDocName

The upshot:
- The form is closed
- The report is displayed
- The report is displayed hidden UNDER the data entry screen
- I click on the report
- I click on the toolbar printer icon
- The message Now Printing is displayed
- An error appears "The expression is typed incorrectly or is too complex to be evaluated"

Something I think is wrong with (B)

Anyone think they got it?

Paul
HiTechCoach
The issue is probablywith this:

--stDocName = "frmFacultyBudgetReport"
--DoCmd.OpenForm stDocName, acNormal, , , , acDialog
--DoCmd.Close acForm, stDocName


I woudl remove the: DoCmd.Close acForm, stDocName line

In the "frmFacultyBudgetReport", when the user click "contiues" or "OK" you need to set the form's visible proper;y to NO. This will allow the report to stil up the pop up form and the report will display on top.
swmagic
WOW!. Great job Batman Boyd! Yes, that fixed it.

But why did it fix it? What was the message all about? What expression did it think was typed incorrectly?

Paul
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.