Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro Condition with DIR command

Status
Not open for further replies.

ebrooks54

IS-IT--Management
Dec 4, 2002
54
0
0
US
I have a macro in Access 2003 that has the following condition associated with it:

Dir("Indigo POS Data.TXT")>""

In Access XP the query ran with no problems. Running it under Access 2003, I am getting a dialog box with the message: "The expression you entered has a function name that ... can't find."

Can anyone tell me what is wrong with the expression?

Thanks
 
Probably a security issue (something like SandBox).
You may consider to save your macro as a VBA function.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I don't see what you are getting at. What I am trying to do is as follows:

If the text file is present, there are 6 queries to run and then code is run to move the text file to a backup folder. I do this by putting conditions on each line of the macro:

Dir("xxxx.txt")>"" openquery
...
...
...
... RunCode
Dir("xxxx.txt")="" MsgBox (Display a messsage that there is no file to process)

It executed fine in Access 2002, but gives an error in Access 2003. If I delete the conditions the macro runs fine.

Thanks
 
Does your 2003 DB compiles properly ?
When in VBE (Ctrl+G) menu Debug -> compile ...
No reference problem ?
menu Tools -> References ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
OK. Learn something new everyday.

When I converted the macro to a module it worked fine. Beats me as to why.

Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top