Wrox Programmer Forums
|
BOOK: Beginning Access 2003 VBA
This is the forum to discuss the Wrox book Beginning Access 2003 VBA by Denise M. Gosnell; ISBN: 9780764556593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Access 2003 VBA 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 30th, 2006, 12:35 PM
Authorized User
 
Join Date: Jun 2006
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default On Load: "Invalid Outside Procedure"

Hi,
I have an error message popping up when I load a form, saying:

The expression On Load you entered as the event property setting produced the following error:
Invalid Outside procedure.
* The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure]
* There may have been an error evaluating the function, event, or macro.

This is my entire function:

Private Sub Form_Load()
    NavigationButtons = False
End Sub

Also, this was working completely fine, until I added an array declaration in the Declarations section. Earlier, my declaration section only had:

Option Compare Database
Option Explicit

Now it has:

Option Compare Database
Option Explicit
Dim regions(1 To 8) As String
   regions(1) = "Atlanta"
   regions(2) = "GTA"
   regions(3) = "Huron Rideau"
   regions(4) = "North-West Territories"
   regions(5) = "Pacific"
   regions(6) = "Prairie(s)"
   regions(7) = "Quebec"
   regions(8) = "Other"

I added this because I would be using the array from other Subs in the module.

Could anyone tell me why this is giving me an error?

Thank you!
Kriti

 
Old June 30th, 2006, 01:01 PM
Authorized User
 
Join Date: Jun 2006
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I just realized actually, that I'm getting the exact same error for EACH sub, not just the form_load() one. So any button that I click on, I get that error. Basically my form isn't able to do anything!

 
Old July 21st, 2006, 07:21 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

It has to do with lines of code outside your procedure. I will bet if you removed Option Explicit after Option Compare Database, this will prevent this error.

mmcdonal
 
Old March 1st, 2007, 11:53 AM
Registered User
 
Join Date: Mar 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I just came across this same issue - a very simple event procedure that worked fine until I declared and set a variable in the declarations section of the module. With a little experimenting, I found that it was OK to declare the variable, but that setting the variable in the declarations section caused the error to occur.

My workaround was to declare the variable in the declarations section and set it in the Load event of the form. This looks to be working just fine.

Peter Larsen
Altaveo, Inc.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Stored Procedure Load huju1977 SQL Server 2000 1 May 30th, 2007 03:51 AM
Invalid Argument ppenn Access VBA 2 May 14th, 2007 10:11 AM
Load Report Failed - Invalid Table Number rstaubitz Crystal Reports 0 December 28th, 2005 10:07 AM
Invalid procedure call Error pavel Pro VB 6 2 January 30th, 2004 10:00 AM
Invalid procedure call or argument: 'AscB' harish3699 VBScript 1 January 28th, 2004 01:29 PM





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