Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > BOOK: Beginning Access 2003 VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 30th, 2006, 12:35 PM
Authorized User
 
Join Date: Jun 2006
Location: , , .
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

Reply With Quote
  #2 (permalink)  
Old June 30th, 2006, 01:01 PM
Authorized User
 
Join Date: Jun 2006
Location: , , .
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!

Reply With Quote
  #3 (permalink)  
Old July 21st, 2006, 07:21 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
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
Reply With Quote
  #4 (permalink)  
Old March 1st, 2007, 11:53 AM
Registered User
 
Join Date: Mar 2007
Location: , , .
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 12:42 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.