Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access 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 August 27th, 2003, 11:10 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Naperville, IL, USA.
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Default VBA code failure

Whenever a particular database form tries to execute any VBA code, I get the following error message:

 
Quote:
quote:The expression XXXXXXX you entered as the event property setting produced the following error: A problem occurred while Microsoft Access was communicating with the OLE server or ActiveX Control.


XXXXXXX is the name of the event (After_Update, Before_Update, Form_Load, Current, etc).

This occurs even if the code for the event is something as simple as Me.Refresh. If I reference a function or subroutine, the form behaves as if the function or subroutine doesn't exist. The same error occurs if I try to execute the procedure from the immediate window.

Can this be fixed or should I start over?

Rand
__________________
Rand
 
Old August 28th, 2003, 07:58 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
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

Rand,

Have you made sure that all the appropriate reference libraries are active?


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old February 19th, 2004, 01:13 PM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello to all!

I have the same problem. rgerald, did you find a solution?

Thanks

Paul

 
Old February 19th, 2004, 01:28 PM
Authorized User
 
Join Date: Jun 2003
Location: Glendale, AZ, USA.
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi there,
  What controls are on the form?

  Does the code manually compile?

Mike
 
Old February 19th, 2004, 01:33 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Naperville, IL, USA.
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This was a while back, but I think it turned out to be related to references. If the references list is not complete for ALL CODE, similar messages may appear.

Sometimes the message may refer to an unrelated reference that actually does exist, even though the actual missing reference is in a different library.

Rand
 
Old February 19th, 2004, 01:45 PM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Mike,

Thanks for answering.

The form has one button and one subform.

The only thing I am trying to do is to requery the subforms data.

So, on button_click I have imported the following:
Command1_Click()
  Subformname.Requery
End sub

Eventhough I can compile the source code manually, on Form view button_click returns with the following message:

The expression on click you entered as the event property setting produced the following error: A problem occurred while MyTable was communicating with the OLE server or ActiveX Control.
*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.

Thanks,

Paul
 
Old February 19th, 2004, 02:05 PM
Authorized User
 
Join Date: Jun 2003
Location: Glendale, AZ, USA.
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What happens if you replace the refresh code with msgbox "Refresh"?

Did you check your references to make sure that none are missing?

You might try rebuilding the form from scratch and see if the problem presents itself. The form may be corrupt.

HTH,
Mike
 
Old February 19th, 2004, 02:07 PM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Rand,

Sorry for disturbing you again but how can I be sure that the reference's list is complete for all code?

Thanks,

Paul
 
Old February 19th, 2004, 02:18 PM
Authorized User
 
Join Date: Jun 2003
Location: Glendale, AZ, USA.
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In the VB Editor window goto Tools | References. If there is a missing reference it will have the word MISSING in front of the reference.

Mike
 
Old February 19th, 2004, 02:23 PM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Mike, you are right! I created the form from the beginning and I don't have the same problem now.
But what do you mean with corrupted?
When does a form get corrupted? Is there a rule for this?

Thanks,

Paul




Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Code D0MiN0 Access VBA 2 March 31st, 2008 03:55 AM
Code works in Excel VBA but not Access VBA fossx Access VBA 2 May 21st, 2007 08:00 AM
vba code in.ssuresh Excel VBA 1 November 28th, 2005 05:10 AM
Help with VBA Code KevinN Excel VBA 1 April 22nd, 2005 06:50 AM
Download of code - Failure Mark200408 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 5 September 11th, 2004 08:14 PM





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