Missing Reference??

Sprocket

Registered User.
Local time
Today, 23:08
Joined
Mar 15, 2002
Messages
70
While looking at the forum the other day I found an entry that showed how to return the path of the current database.

This is the code.........

Dim db As DAO.Database
Dim strPath As String
Dim intCharacter As Integer
Set db = CurrentDb

strPath = db.Name
intCharacter = InStrRev(strPath, "\")
strPath = Left(strPath, intCharacter)

'Use this code block to retrieve the path or the current database.


There were 2 problems... I've fixed one but I'll explain in case the second is similar but I just can't see it.
The first line of code....
Dim db As DAO.Database
the DAO.Database gave an error message "User-defined type not defined"
I fixed this by going into Tools/References in the VBA code window and ticking the item
Microsoft DAO 3.6 Object Library

The problem I can't resolve is in the last line of code...
strPath = Left(strPath, intCharacter)

I get an error message saying "Ambiguous term" in respect of the Left 'function'

Now as I understand it this is an intrinsic function of VBA so why does it not recognise it. It doesn't recognise 'Right' either, but I'm OK with things like 'Len' and 'StrConv'

Am I missing another reference? I have tried ticking all the items that looked anything like possible but I've not found one that works.
Any Ideas will be graetfully recieved.


[This message has been edited by Sprocket (edited 04-16-2002).]

[This message has been edited by Sprocket (edited 04-16-2002).]
 
Have had the same problem in the past. Found that deselecting the VBA Reference, closing access, then reselecting the VBA reference does the trick.

Also look through the object browser as that ought to show once it is loaded.

[This message has been edited by Harry (edited 04-16-2002).]
 
That's fixed it.... Great.

Many thanks
 

Users who are viewing this thread

Back
Top Bottom