473,569 Members | 2,799 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Undefined Function "DIR" in expression

I'm not sure where this routine came from,
but here is the problem. On certian computers
this error occurs, but it does not on others.
The error is: "Undefined Function "DIR" in expression".

The form open event calls the CheckandRepairL inks
without a varable being passed it it.

CheckandRepairL inks

The instruction that fails is the Set instruction
pointing to the DIR instruction.

Set RecordSetOfLink s = dbs.OpenRecords et(LinksToPaths SQL)

I really don't know what to do with this because it
is saying it can't find the DOS command "DIR'. In other
forms I have the DIR command and I don't get the error.
Also, I checked and there are no missing references.

Below is a snapshot of the Checkand RepairLinks procedure.

Private Sub CheckandRepairL inks(Optional ByRef dbs As
Database)

' An SQL String To Return a List of Linked DataBases Files
' which cannot be found
Const LinksToPathsSQL As String = _
"SELECT TOP 1 CStr(DataBase) AS DatabaseFile " _

& "FROM MSysObjects " _
& "WHERE Connect Is Null " _
& "AND Left(Name,1) <> '~' " _
& "AND Type = 6 " _
& "AND Len(Dir(CStr(Da taBase))) = 0 " _
& "ORDER BY CStr(DataBase); "

' Message to be sent on Cancel or Exit being chosen from
File Dialog Box
Const FileNotChosenMe ssage As String = _
"No File was Chosen!" _
& vbCrLf _
& "Click OK to Continue " _
& vbCrLf _
& "Click Cancel to Exit Link Checking"

Dim DbsWasPassed As Boolean
Dim NameNotIn As String
Dim RecordSetOfLink s As Recordset
Dim OldPath As String
Dim ButtonSelected As Long
Dim NewPath As String
Dim TableDefinition As TableDef

' display relinking message
'lblVerifyingLo cationofLinkedT ables.Visible = True
DoEvents

If dbs Is Nothing Then
Set dbs = DBEngine(0)(0)
Else
' note if the DataBase was passed
DbsWasPassed = True
End If

' Dummy NameNotIn
NameNotIn = "'" & Chr(255) & "'"

' refresh the tabledefs collection
dbs.TableDefs.R efresh

Do

' Get the first linked lost mdb
Set RecordSetOfLink s = Nothing
' MsgBox LinksToPathsSQL , vbCritical, "Link To Path
SQL"
Set RecordSetOfLink s =
dbs.OpenRecords et(LinksToPaths SQL)

-- Cut
Thanks,
Ron
--
Ronald W. Roberts
Roberts Communication
rw************* ******@robcom.c om
To reply remove "_at_robcom_dot _com"
Nov 12 '05 #1
3 6086
"Ronald W. Roberts" <rw*@robcom.com > wrote in
news:3F******** *******@robcom. com:
I'm not sure where this routine came from,
but here is the problem. On certian computers
this error occurs, but it does not on others.
The error is: "Undefined Function "DIR" in expression".

The form open event calls the CheckandRepairL inks
without a varable being passed it it.

CheckandRepairL inks

The instruction that fails is the Set instruction
pointing to the DIR instruction.

Set RecordSetOfLink s = dbs.OpenRecords et(LinksToPaths SQL)

I really don't know what to do with this because it
is saying it can't find the DOS command "DIR'. In other
forms I have the DIR command and I don't get the error.
Also, I checked and there are no missing references.

Below is a snapshot of the Checkand RepairLinks procedure.

Private Sub CheckandRepairL inks(Optional ByRef dbs As
Database)

' An SQL String To Return a List of Linked DataBases Files
' which cannot be found
Const LinksToPathsSQL As String = _
"SELECT TOP 1 CStr(DataBase) AS DatabaseFile " _

& "FROM MSysObjects " _
& "WHERE Connect Is Null " _
& "AND Left(Name,1) <> '~' " _
& "AND Type = 6 " _
& "AND Len(Dir(CStr(Da taBase))) = 0 " _
& "ORDER BY CStr(DataBase); "

' Message to be sent on Cancel or Exit being chosen from
File Dialog Box
Const FileNotChosenMe ssage As String = _
"No File was Chosen!" _
& vbCrLf _
& "Click OK to Continue " _
& vbCrLf _
& "Click Cancel to Exit Link Checking"

Dim DbsWasPassed As Boolean
Dim NameNotIn As String
Dim RecordSetOfLink s As Recordset
Dim OldPath As String
Dim ButtonSelected As Long
Dim NewPath As String
Dim TableDefinition As TableDef

' display relinking message
'lblVerifyingLo cationofLinkedT ables.Visible = True
DoEvents

If dbs Is Nothing Then
Set dbs = DBEngine(0)(0)
Else
' note if the DataBase was passed
DbsWasPassed = True
End If

' Dummy NameNotIn
NameNotIn = "'" & Chr(255) & "'"

' refresh the tabledefs collection
dbs.TableDefs.R efresh

Do

' Get the first linked lost mdb
Set RecordSetOfLink s = Nothing
' MsgBox LinksToPathsSQL , vbCritical, "Link To Path
SQL"
Set RecordSetOfLink s =
dbs.OpenRecords et(LinksToPaths SQL)

-- Cut
Thanks,
Ron
--
Ronald W. Roberts
Roberts Communication
rw************* ******@robcom.c om
To reply remove "_at_robcom_dot _com"


Perhaps, you have a missing or broken reference on those machines where
"Dir" is raising an error?

The origin of the code ... do you think it might be your responsibility to
find out what it is? ... and as a courtesy credit the author in your code
with a comment?

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #2
Lyle Fairfield wrote:
"Ronald W. Roberts" <rw*@robcom.com > wrote in
news:3F******** *******@robcom. com:
I'm not sure where this routine came from,
but here is the problem. On certian computers
this error occurs, but it does not on others.
The error is: "Undefined Function "DIR" in expression".

The form open event calls the CheckandRepairL inks
without a varable being passed it it.

CheckandRepairL inks

The instruction that fails is the Set instruction
pointing to the DIR instruction.

Set RecordSetOfLink s = dbs.OpenRecords et(LinksToPaths SQL)

I really don't know what to do with this because it
is saying it can't find the DOS command "DIR'. In other
forms I have the DIR command and I don't get the error.
Also, I checked and there are no missing references.

Below is a snapshot of the Checkand RepairLinks procedure.

Private Sub CheckandRepairL inks(Optional ByRef dbs As
Database)

' An SQL String To Return a List of Linked DataBases Files
' which cannot be found
Const LinksToPathsSQL As String = _
"SELECT TOP 1 CStr(DataBase) AS DatabaseFile " _

& "FROM MSysObjects " _
& "WHERE Connect Is Null " _
& "AND Left(Name,1) <> '~' " _
& "AND Type = 6 " _
& "AND Len(Dir(CStr(Da taBase))) = 0 " _
& "ORDER BY CStr(DataBase); "

' Message to be sent on Cancel or Exit being chosen from
File Dialog Box
Const FileNotChosenMe ssage As String = _
"No File was Chosen!" _
& vbCrLf _
& "Click OK to Continue " _
& vbCrLf _
& "Click Cancel to Exit Link Checking"

Dim DbsWasPassed As Boolean
Dim NameNotIn As String
Dim RecordSetOfLink s As Recordset
Dim OldPath As String
Dim ButtonSelected As Long
Dim NewPath As String
Dim TableDefinition As TableDef

' display relinking message
'lblVerifyingLo cationofLinkedT ables.Visible = True
DoEvents

If dbs Is Nothing Then
Set dbs = DBEngine(0)(0)
Else
' note if the DataBase was passed
DbsWasPassed = True
End If

' Dummy NameNotIn
NameNotIn = "'" & Chr(255) & "'"

' refresh the tabledefs collection
dbs.TableDefs.R efresh

Do

' Get the first linked lost mdb
Set RecordSetOfLink s = Nothing
' MsgBox LinksToPathsSQL , vbCritical, "Link To Path
SQL"
Set RecordSetOfLink s =
dbs.OpenRecords et(LinksToPaths SQL)

-- Cut
Thanks,
Ron
--
Ronald W. Roberts
Roberts Communication
rw************* ******@robcom.c om
To reply remove "_at_robcom_dot _com"


Perhaps, you have a missing or broken reference on those machines where
"Dir" is raising an error?

The origin of the code ... do you think it might be your responsibility to
find out what it is? ... and as a courtesy credit the author in your code
with a comment?

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)


It's not a broken reference, that has already bee checked.

Ron
--
Ronald W. Roberts
Roberts Communication
rw************* ******@robcom.c om
To reply remove "_at_robcom_dot _com"
Nov 12 '05 #3
Hi Ronald,

I am able to reproduce the error message you show if I have the registry setting for the
sandbox mode set to either 1 or 3. If the setting is at the default value of 2, I do not
generate this error.

Microsoft Jet 4.0 Expression Can Execute Unsafe Visual Basic for Applications Functions
http://support.microsoft.com/default.aspx?kbid=294698

At the end of your example, you indicated: -- Cut
Would you be so kind as to supply the rest of the code. I am very much interested in
receiving a sample database with this functionality.

Tom
_______________ _______________ ______________

"Ronald W. Roberts" <rw*@robcom.com > wrote in message news:3F******** *******@robcom. com...

I'm not sure where this routine came from,
but here is the problem. On certian computers
this error occurs, but it does not on others.
The error is: "Undefined Function "DIR" in expression".

The form open event calls the CheckandRepairL inks
without a varable being passed it it.

CheckandRepairL inks

The instruction that fails is the Set instruction
pointing to the DIR instruction.

Set RecordSetOfLink s = dbs.OpenRecords et(LinksToPaths SQL)

I really don't know what to do with this because it
is saying it can't find the DOS command "DIR'. In other
forms I have the DIR command and I don't get the error.
Also, I checked and there are no missing references.

Below is a snapshot of the Checkand RepairLinks procedure.

Private Sub CheckandRepairL inks(Optional ByRef dbs As
Database)

' An SQL String To Return a List of Linked DataBases Files
' which cannot be found
Const LinksToPathsSQL As String = _
"SELECT TOP 1 CStr(DataBase) AS DatabaseFile " _

& "FROM MSysObjects " _
& "WHERE Connect Is Null " _
& "AND Left(Name,1) <> '~' " _
& "AND Type = 6 " _
& "AND Len(Dir(CStr(Da taBase))) = 0 " _
& "ORDER BY CStr(DataBase); "

' Message to be sent on Cancel or Exit being chosen from
File Dialog Box
Const FileNotChosenMe ssage As String = _
"No File was Chosen!" _
& vbCrLf _
& "Click OK to Continue " _
& vbCrLf _
& "Click Cancel to Exit Link Checking"

Dim DbsWasPassed As Boolean
Dim NameNotIn As String
Dim RecordSetOfLink s As Recordset
Dim OldPath As String
Dim ButtonSelected As Long
Dim NewPath As String
Dim TableDefinition As TableDef

' display relinking message
'lblVerifyingLo cationofLinkedT ables.Visible = True
DoEvents

If dbs Is Nothing Then
Set dbs = DBEngine(0)(0)
Else
' note if the DataBase was passed
DbsWasPassed = True
End If

' Dummy NameNotIn
NameNotIn = "'" & Chr(255) & "'"

' refresh the tabledefs collection
dbs.TableDefs.R efresh

Do

' Get the first linked lost mdb
Set RecordSetOfLink s = Nothing
' MsgBox LinksToPathsSQL , vbCritical, "Link To Path
SQL"
Set RecordSetOfLink s =
dbs.OpenRecords et(LinksToPaths SQL)

-- Cut
Thanks,
Ron
--
Ronald W. Roberts
Roberts Communication
rw************* ******@robcom.c om
To reply remove "_at_robcom_dot _com"

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4316
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing result in any way. Who can help me, I thank you very very much. list.cpp(main program)...
3
1654
by: MLH | last post by:
Back in '98, Trevor Best posted a 1-liner I consider to be an excellent suggestion: Dir("\testdir\nul") If I have an actual directort named c:\bat and I run Dir("c:\bat\nul") in the immediate window, 'nul' is returned. On the other hand, if I run Dir("c:\baat\nul"), the debug window just displays an empty line. I was wondering
2
1129
by: VB Programmer | last post by:
I want to write a file to the "secured" dir that is on my website. The full path is: C:\inetpub\wwwroot\MyWebSite\Secured I tried this, but it didn't work: Dim strFileName As String = "Secured\MyFile.txt" Dim sw As New StreamWriter(strFileName) sw.WriteLine("Testing 1-2-3") sw.Close() Response.Redirect(strFileName)
6
1532
by: iris | last post by:
Hi all, What is the simplest way to get a list of all the files in a directory, (on an ipaq) something equivalent to "dir *.* > file" . No need to list directories. I have visual studio 2003 (does this mean I have .NET CF??)
7
2743
by: per9000 | last post by:
Dear Black Knight, I have no quarrel with you sir Knight, but I must import your parents. SHORT VERSION: I tried three variants of "from ../brave.py import sir_robin", one works. I want to use it in a py-file to execute command-line-style and that does not work.
3
7764
by: Michele Petrazzo | last post by:
Hi, I'm trying a script on a debian 3.1 that has problems on shelve library. The same script work well on a fedora 2 and I don't know why it create this problem on debian: #extract from my code import shelve class XX: def __init__(self): self._data = shelve.open("/tmp/myfile")
1
6462
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located...
7
1771
by: runsun pan | last post by:
I wanna check if an object is the *arguments* object of a function, is that possible? When we do: typeof(arguments) it always returns "object", doesn't seem to be helpful.
3
1401
by: Sheila Jipping | last post by:
I have a working application which has loaded fine on 2002 and 2003 Access installation. I installed the same app on a 2000 Access and I am receiving "undefined function 'Dir' in expression". I've compared references with the working installations and they are the same. The app does use the DIR command to validate that some files exist.
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8120
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7968
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6283
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.