|
|
Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
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.
|
|
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)
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please)
<ZX10[ at ]spamthis.com> wrote in message news:svss92hnq07j763m3mucf502fd9fkthbtq[ at ]4ax.com...
[Quoted Text] >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.
|
|
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?
On Sun, 25 Jun 2006 10:14:34 -0400, "Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_canada.com> wrote:
[Quoted Text] >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)
|
|
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?
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!)
<zx10[ at ]spamthis.com> wrote in message news:v8dv92p08vdr7dbo3cua41tabrh92d0242[ at ]4ax.com...
[Quoted Text] > 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? > > > > On Sun, 25 Jun 2006 10:14:34 -0400, "Douglas J. Steele" > <NOSPAM_djsteele[ at ]NOSPAM_canada.com> wrote: > > >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)
|
|
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
On Mon, 26 Jun 2006 08:07:46 -0400, "Douglas J Steele" <NOSPAM_djsteele[ at ]NOSPAM_canada.com> wrote:
[Quoted Text] >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?
|
|
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.
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!)
<ZX10[ at ]spamthis.com> wrote in message news:q632a2tdnqm0b0e3a4c5f71fi981mvrljn[ at ]4ax.com...
[Quoted Text] > 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 > > On Mon, 26 Jun 2006 08:07:46 -0400, "Douglas J Steele" > <NOSPAM_djsteele[ at ]NOSPAM_canada.com> wrote: > > >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?
|
|
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)
<zx10[ at ]spamthis.com> wrote in message news:v8dv92p08vdr7dbo3cua41tabrh92d0242[ at ]4ax.com...
[Quoted Text] > 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? > > > > On Sun, 25 Jun 2006 10:14:34 -0400, "Douglas J. Steele" > <NOSPAM_djsteele[ at ]NOSPAM_canada.com> wrote: > > >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)
|
|
|