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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Expression typed incorrectly...

Status
Not open for further replies.

swmagic

Programmer
May 18, 2004
23
US
I click on a report button on frmA (data entry form) that brings up the report's parms on frmB. Then I click on the print button in frmB, close frmB and the rptC displays. When I click the toolbar print icon, it says "Now Printing" followed immediately with the message "The expression is typed incorrectly or it is too complex to be evaluated"

frmA
Code:
stDocName = "frmB"
DoCmd.OpenForm stDocName, , , , , acDialog
DoCmd.Close acForm, stDocName

In frmB, the print button has:

Code:
stDocName = "rptC"
DoCmd.OpenReport stDocName, acPreview
DoCmd.Close acForm, "frmB"  
DoCmd.SelectObject acReport, "rptC"

It looks good until I click the printer icon in the toolbar when I get the error message.

Thanks
 
How are ya swmagic . . .

Code:
[blue]Change:
DoCmd.OpenReport stDocName, [purple][b]acPreview[/b][/purple]
To:
DoCmd.OpenReport stDocName, [purple][b]acViewPreview[/b][/purple][/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Nope. Didn't do anything. What's the difference?
 
swmagic said:
[blue]Nope. Didn't do anything. [purple]What's the difference?[/purple][/blue]
[purple]acPreview[/purple] is for forms, [purple]acViewPreview[/purple] is for reports.I didn't really think this was the problem, just wanted to get the line proper 1st.

My 1st worthy suggestion is to leave the parameter form [blue]frmB[/blue] open and see what happens. Just [blue]rem[/blue] out the lines as you see them.
Code:
[blue]stDocName = "rptC"
DoCmd.OpenReport stDocName, acPreview
[green]'DoCmd.Close acForm, "frmB"  
'DoCmd.SelectObject acReport, "rptC"[/green][/blue]
If the above doesn't work, then the fault is most likely in the [blue]RecordSource[/blue] property of the report (parameters are certainly collected here). Post the [blue]RecordSource[/blue] of the report if the above fails . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
True, the last two lines were added as a workaround to the initial problem. With those removed, frmB is highlighted and stuck, rptC just underneath it. Stuck means that I cannot click on anything in the toolbar, nor the report...just frmB (modal and popup="yes"?)

Note that the main menu directly calls frmB which calls rptC, separate from the more complex mechanism, and that call works fine.

So how would the recordsource be a consideration if frmB and rptC are the same?
 
swmagic . . .

That means [blue]frmB[/blue] was open modal!. Release the [blue]SelectObject[/blue] line, so its active . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Ok, sounds awesome and I'm really excited to try that out...

Just one problem.

I need a translation of what that means. ;-)

Clueless in LA.
 
swmagic . . .

In your post origination you opened with [blue]acDialog[/blue] . . . which is [blue]modal mode![/blue] . . . Meaning this form will stay on top of all [blue]non-modal[/blue] forms & reports! In such an instance, you need to set focus/activate the form/report in question to bring it to the top!

Hope the explanation is worthy! . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Isn't that what

DoCmd.SelectObject acReport, "rptC"

did? (in the 16:38 post above)

We commented that out. Even with that live, the error message stil comes up.

And closing frmB just prior ot that should have closed the "modal" behavior anyway, right?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top