declaring a variable as "Index" turned out into "index"

R

rocco

Hello,
it can sounds weird but I'm stocked into trying to declaring a variable as
index.
Immediately after digitizing the statement it changes "Index" into "index"
and the code will not work.
I need the variable to iterate through the Indexes collection of a Dao
recordset.
This recordset is opened as dbOpenTable and until now I have created one
index only, the primary key, when I built the table.
The DAo 3.6 library has been correctly referenced.
What's wrong?
Thanks,
Rocco
 
C

coasterman via AccessMonster.com

If I understand your post correctly, instead of:

Dim index as Index

which is what I suspect you are trying to do (and running fould of the editor
quirks, declare is as follows:

Dim index as DAO.Index

This way the variable name stays lower case.

Cheers
 
R

rocco

sorry... I made a mistake... I clicked on "usefull" but actually it hasn't
solved my problem.

The *thing* is that I would like to get
dim idx as Index (or DAO.Index)

but instead I get
dim idx as index (or DAO.index)

thanks!
rocco
 
R

RD

I see you've fixed one thing: it's never a good idea to use reserved
words as variable names.

I tried what you did, I declared a variable:
Dim index as DAO.Index

And it gave me the same this as your's. Even after I deleted the bad
declaration and typed a new one, the code window kept returning index
instead of Index.

I haven't taken it any further than that but I suspect that you've
taught VBA a new type of index. I had to open a different db before
the code window would give me a proper Index. You just might have to
create a new module and copy over everything except for the bad
declaration before it starts working correctly.

Good luck,
RD
 

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