Solved

Custom ActiveX Method clash

Posted on 2004-10-15
9
211 Views
Last Modified: 2013-11-25
Hi,

I am developing an ocx in VB6. The ocx has a public method called Requery.

The ocx will be used in a Form in an MSAccess database. There will be a button which when clicked will run the following code...

MyOCXControl.Requery

This should run the public method Requery. It doesn't. This is because MSAccess seems to assign some default methods for custom controls used in it, one of which is Requery. This method seems to override the controls method and obviously does nothing.

Is there any way to override the Requery Method that MSAccess assigns?

Many Thanks in advance.

Cheers,

Rhydian.
0
Comment
Question by:Rhydian
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
9 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 12317870
>>MyOCXControl.Requery

>>This should run the public method Requery. It doesn't

If MyOCXControl is your ocx object, then it should run requery function inside that object.
Don't quite sure what you mean
0
 
LVL 1

Author Comment

by:Rhydian
ID: 12317958
Let me try and explain...

When you place any third party Activex control into an Access Form/Report, Access exposes some default properties and methods to it (as well as the ones defined within the control), One of these default methods is Requery. This method is in conflict with one I have defined within the control and seems to overrides it.

Try it. Drop any third party control onto a Form and in the code window of the Form type...

me.nameofcontrol.

This will bring up all the properties and methods, one of which is Requery.

Hope this explains the situation and you can help.

Cheers,

Rhydian.
0
 
LVL 32

Accepted Solution

by:
Erick37 earned 500 total points
ID: 12319111
"Requery" is a reserved word in Access.  You should rename your method in order to avoid this conflict.

http://support.microsoft.com/default.aspx?scid=kb;EN-US;209187
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:Rhydian
ID: 12319430
Thanks for that.

It does sort of make sense, but for the fact that my control can have a method called Refresh, which is a reserved word and not have the problem I have described!

Renaming the method seems the only solution (at present), but I would rather not do this as my control is an enhanced listbox and I would like to keep the methods and properties the same as the MSAccess listbox, so that I can replace MSAccess listboxes in my applications with the new control without having to amend any application code related to the control. i.e if there is code like...Listbox.Requery I would still like it to run regardless of whether the control is a MSAccess listbox or my control.

Any other ideas?

Cheers,

Rhydian.
0
 
LVL 32

Assisted Solution

by:Erick37
Erick37 earned 500 total points
ID: 12320009
This PAQ deals with this issue, and perhaps there is a workaround - but the *solution* has been deleted!  See ameba's comments and email ameba directly to get some insight into this issue.

Solution Title: Reserved word as public method of class
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_11046623.html

Good Luck!
0
 
LVL 1

Author Comment

by:Rhydian
ID: 12563485
Can I have a refund of the points as no answer given sorts the problem that I am experiencing
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question