Dir function in Access 2003

Z

ZX10

I am converting a database from Access 97 to 2003, and cannot get the
DIR function to work.
Even creating a new database, with a single form, and one text box
=dir("C:\autoexec.bat")
doesn't work.

In all cases I get #Name? error.

What am I doing wrong?
Is this function disabled some where?
(Have checked security on help page - nothing disabled)


Help please.
 
D

Douglas J. Steele

It's possible that your References collection has been corrupted.

References problems can be caused by differences in either the location or
file version of certain files between the machine where the application was
developed, and where it's being run (or the file missing completely from the
target machine). Such differences are common when new software is installed.

Open the VB Editor (Alt F11). Select Tools | References from the menu bar.
Examine all of the selected references.

If any of the selected references have "MISSING:" in front of them, unselect
them, and back out of the dialog. If you really need the reference(s) you
just unselected (you can tell by doing a Compile All Modules), go back in
and reselect them.

If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added. If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out
of the dialog, then go back in and reselect the references you just
unselected. (NOTE: write down what the references are before you delete
them, because they'll be in a different order when you go back in)
 
Z

zx10

Thanks for the response.
Unfortunately it made no difference.
I cannot unselect:
Visual basic for applications
Microsoft access 11.0 object library
All other removed, then selected.
I will note that there are a lot of "visual basic for applications"
listings - seven more with the same name.
Active one is shown with location
C:\program files\common files\microsoft shared\VBA\VBA6\VB....
cannot see past that - dialog box window doesn't allow resizing.

Any other suggestions?
 
D

Douglas J Steele

What happens when you try to use the Dir function in the Immediate window
(Ctrl-G)?

Type:

?Dir("C:\autoexec.bat")

and hit Enter. What's returned?
 
Z

ZX10

Now that's interesting. It works! (I didn't know you could do that)
It returns autoexec.bat
Any clues why it would work here and not in a textbox on a form?

Thanks
 
D

Douglas J Steele

No idea at all. I don't have Access 2003 handy at the moment, but I have no
problem repeating your test form in Access 97.
 
G

Guest

FWIW, to see the rest, go to the immediate window and type
application.references(1).FullPath
while you are there, you can also try .isbroken

Is it only the DIR function? If it's not a broken reference,
do you have something else named 'dir'?

7 installed copies of VBA is rather a lot, even if you have
Office 97, 2000, 2002, 2003 and 2007 installed. See if
you can find and remove any of them.

(david)
 

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