kindly, before I crash this computer against the wall..

R

rocco

....does someone know why when I write this declaration:
dim idx as Index (or even DAO.Index)

it changes into:
dim idx as index (or DAO.index)
....and obviously it screams errors if I run the code.

References seem fine.
 
J

John Spencer

As a guess, you have defined index somewhere in your database. I am surprised
however that Dim idx as DAO.INDEX does not overcome the problem.

Does this happen in just one database or in any database you have?

If just one, you might try to decompile and then compile your VBA code and see
if that helps.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
T

Tom van Stiphout

On Tue, 2 Mar 2010 05:53:01 -0800, rocco

Obviously? That's not obvious to me. VBA is a case-insensitive
language so the two are identical. I see this in my own programs
occasionally and it has never caused any problems. I would highly
recommend prefixing with "DAO.", so as to disambiguate this
declaration from other libraries that may have the same.

-Tom.
Microsoft Access MVP
 
R

rocco

Oh well.. it looks like in another db created from scratch it works nicely
private idx as Index
will remain... Index!

That means there's something in the application I'm working on. I will try
to decompile it and re-compile to see what happens.

Thanks,
rocco
 
R

rocco

I'm going nuts...update:
the word "index" is a parameter used in Ribbon callbacks. I cannot change it
or I will screw all the ribbon customization which has taken me forever and
now works like a charm.
Could be this?
 
R

rocco

I tried, but it still screams that the object "index" doesn't exist. Nice
that in intellisense you can see inn all his glory.
 
J

John Spencer

Yes, it could be that is the problem.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
R

RD

I replied to an earlier part of this thread. I did some experimenting.
Once I had declared index, I couldn't get VBA to NOT use index even
after I had deleted the bad declaration. I had to kill the module and
open a new one.

Using reserved words as variable names is a no-no for just this
reason. If you've declared index anywhere in your code, you'll need to
change it to a non-reserved word. Once that's done, if it's still
giving you problems, you may have to create new modules and copy
everything but the bad declarations into them and then kill the old
modules.

Never use reserved words for variable names.

HTH,
RD
 
R

rocco

That's a good point. A reasonable one, but... It is not me that have used a
reserved word to declare a variable. It is Microsoft!!! The callbacks for
customizing the Ribbon are pre-built.

rocco
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top