Function name Access can't find

T

Terry

Dear All,

This is a follow on from an earlier post I had in
the "External Data" group. I am still having problems and
suspect this may be a more appropriate place to ask.

Whenever I try and use the "Dir" function I get a message
saying The function name can't be found. Douglas J Steele
pointed me at the references and suggested importing all
objects into a new DB. I have re-referenced everything
Access will allow me to. Subsequent testing has shown
the "Dir" function does not work with any database. If I
enter "dir("")" into a form control it will accept it as a
function and format it to "Dir ("")" with the capital D.
The object browser finds the Dir function. The function
won't work though.

I have tried to re-register the DLLs with REGSVR32.exe.
The MSO.DLL fails to register properly .... but also fails
in the same way on PCs that are working?

I have used uninstall programs to remove Office and re-
install office (most of the shared components appear
unaffected by this) and re-applied service packs.

This fault has only shown up since an FDisk and complete
re-build of my PC (about a two day job).

I am hoping to avoid another complete rebuild. Has anyone
any suggestions, ideas, anything ... ?

Access 2002 SP3
Win2k SP4

Thanks in advance,

Terry
 
A

Albert D. Kallal

If I
enter "dir("")" into a form control it will accept it as a
function and format it to "Dir ("")" with the capital D.

I don't think the dir command works that way. Did you even both to check the
help?

You can certainly try:

=Dir("*.*")

The above should work..but if you read the help...how can really use the dir
function directly in a control?

Where did you get such a silly idea?

Anyway, trying reading the help on dir. Also, give the above example a
try...it works on my computer...but the results are kind of useless......
 
T

Terry

Albert,

Thanks for your response.

You can use the Dir as I used in the example (it will
return the first file in the current path) however in the
live dbs it is used in code and macros to check for the
existence of text files prior to importing them and it
works on other PCs and used to work on mine. I am trying
to find out why this function "can't be found" by Access.
I really don't want to have to completely re-build my
machine in the hope that it will fix it.

Thanks for your interest and time in reading this saga,

Terry
 
A

Albert D. Kallal

Ok, does the dir command work in code?


For example, can you go in a test module:

Dim strBuf As String

strBuf = Dir("*.*")

Do While strBuf <> ""
Debug.Print strBuf
strBuf = Dir()

Loop

If the above code can't compile on your pc, then you still have a reference
problem

Does the above code work as a test?
 
T

Terry

Albert,

The code compiles and runs OK now ..... beats me because
it definitely wasn't working earlier (it would compile OK).

It still fails when used in a control or in a Macro.

I have quite a few text imports that will run if
Dir([forms]![myform].[FileAndPathname])<>"" if this type
of condition is met. I still cannot get past a
message "The expression you entered has a function name
that Access cant find". The same macros and etc used to
work and still work elsewhere?

Something appears to have changed as it will work from a
module now? The recent testing I have done was with a dir
function in a form so when it started working from within
a module I don't know.

Thanks for your input and making me revisit some areas I
have neglected. Any suggestions on where to go from here
to get it working from a Macro (and as a function in a
form which it should do).

Thanks again,

Terry
 
A

Albert D. Kallal

I am not sure what, or why there is a problem when using the expression in a
form.

You do need to use:

=Dir([Forms]![form2].[text5])<>""

I don't think that the following will work (that is if you are going to make
a text box on a form).

Dir([Forms]![form2].[text5])<>""

(you need the equal sign in front).
I have quite a few text imports that will run if
Dir([forms]![myform].[FileAndPathname])<>"" if this type
of condition is met. I still cannot get past a
message "The expression you entered has a function name
that Access cant find". The same macros and etc used to
work and still work elsewhere?

Hum, I would just change the macro to code..and then you can deal with it
that way.

Unfortunately, I never spent the time to use macros..and thus I don't what
works, and what does not work well.

In code, you can go:

If Dir([forms]![myform].[FileAndPathname]) <> "" then

do whatever

endif

At least your use of dir in code now works....
 
G

Guest

Albert,

Thanks for your guidance and help. I'll blunder along and
start converting the macros. It is still a mystery and a
pain in the proverbial.

Thanks again,

Terry
-----Original Message-----
I am not sure what, or why there is a problem when using the expression in a
form.

You do need to use:

=Dir([Forms]![form2].[text5])<>""

I don't think that the following will work (that is if you are going to make
a text box on a form).

Dir([Forms]![form2].[text5])<>""

(you need the equal sign in front).
I have quite a few text imports that will run if
Dir([forms]![myform].[FileAndPathname])<>"" if this type
of condition is met. I still cannot get past a
message "The expression you entered has a function name
that Access cant find". The same macros and etc used to
work and still work elsewhere?

Hum, I would just change the macro to code..and then you can deal with it
that way.

Unfortunately, I never spent the time to use macros..and thus I don't what
works, and what does not work well.

In code, you can go:

If Dir([forms]![myform].[FileAndPathname]) <> "" then

do whatever

endif

At least your use of dir in code now works....

--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada
(e-mail address removed)
http://www.attcanada.net/~kallal.msn



.
 

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