Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 21st, 2005, 09:59 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default Can wrong event cause report to not compile?

I have a .mdb with a form that allows the user to select criteria, then it saves the results as a qry to use as record source for a report. The report uses the caption property of the form as the caption on labels in the report header. Both the form and the report run, (or at least they appear to) however, when I try to compile I get a runtime error 2450 "database can't the form "frmpracticeresults referred to in macro or vb code".

I have the following code in the on activate and on report header print events and it scores the same error (2450)on each one of them (but RUNS when I launch from the form).

Reports![rptpracticeresults]![lblSortSpec].Caption = Forms![frmpracticeresults]![lblSortSpec].Caption

I've checked my spelling and frmpracticeresults is present and it runs. Am I perhaps in the wrong event, or did I call it wrong? Or something else?
Any help is much appreciated. I want to get this thing compiled so I can see if we can benefit from splitting.
Thanks,

Loralee


 
Old June 22nd, 2005, 10:19 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Put this on the report's header's ON FORMAT event, not in the report's ON ACTIVATE event:

Me.lblSortSpec.Caption = Forms.frmPracticeresults.lblSortSpec.Caption


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old June 22nd, 2005, 10:20 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

If that doesn't work, add an extra .Form property, that is...

Me.lblSortSpec.Caption = Forms.frmPracticeresults.Form.lblSortSpec.Caption


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old June 22nd, 2005, 10:25 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default

Thanks, Greg.

I'll give it a try this week end.
Loralee

 
Old June 26th, 2005, 08:58 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default

Greg,
It looks like just moving the existing code to the Report Header's on FOrmat event, like you said, (and removing the code from the other 2 events) took care of the issue.

THANK YOU very much.

Loralee






Similar Threads
Thread Thread Starter Forum Replies Last Post
Browser back button makes wrong event fire Surre ASP.NET 1.0 and 1.1 Professional 1 March 13th, 2006 03:40 PM
What is wrong witht his crystal report code ceema Crystal Reports 0 February 16th, 2006 12:26 AM
Crystal Report displays wrong value. shilpa_net2004 VB Databases Basics 2 December 31st, 2005 12:09 PM
Crystal Report displays wrong value. shilpa_net2004 Crystal Reports 0 December 13th, 2005 04:30 AM
tomcat doesn't report which line is wrong,help,pls ydlei Apache Tomcat 1 May 12th, 2005 09:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.