Browse folder returns compile error

G

Guest

I am trying to use the following code, which works fine when in its own
database, but when I import it into the actual database I get this compile
error message Sub or function not defined. It then puts a yellow arrow next
to private & highligt it & puts the words BrowseFolder in reverse.

Private Sub cmdChooseDir_Click()
Dim strFolderName As String
strFolderName = BrowseFolder("What Folder you want to select?")
Me.txtDir = strFolderName
Me.lstDirFiles = ""
End Sub
 
D

Dirk Goldgar

amiga1200 said:
I am trying to use the following code, which works fine when in its
own database, but when I import it into the actual database I get
this compile error message Sub or function not defined. It then puts
a yellow arrow next to private & highligt it & puts the words
BrowseFolder in reverse.

Private Sub cmdChooseDir_Click()
Dim strFolderName As String
strFolderName = BrowseFolder("What Folder you want to select?")
Me.txtDir = strFolderName
Me.lstDirFiles = ""
End Sub

BrowseFolder is not a built-in function. In the original database it
was probably defined in a standard module, and you haven't include that
module in the current database. Locate the module containing the
definition of the BrowseFolder function, and import that module into the
database you're working on now. The module may or may not contain other
code that isn't relevant to that function, but unless you understand the
code, you'd probably better not go cutting anything out of it unless you
get errors when you compile.
 
G

Guest

When the vlaue is between two items, when I use the subform as a form, it
works, but when it is a subform it keeps crashing Access 2003.
 
G

Guest

Thanks for the info I have found to modules that you were referring to, but
now this line is causing an error
Dim myFileSystem As New FileSystemObject
User-defined type not defined

I have double checked to see if I haven't imported something.
 
D

Dirk Goldgar

amiga1200 said:
Thanks for the info I have found to modules that you were referring
to, but now this line is causing an error
Dim myFileSystem As New FileSystemObject
User-defined type not defined

I have double checked to see if I haven't imported something.

Declaring a FileSystemObject requires a reference set to an object
library that defines it. In the VB Editor, click Tools ->
References..., look through the list for "Windows Script Host Object
Model", and put a check mark in the box next to it. If you don't find
that one, look for others that refer to "Windows Scripting" in their
names, and try each in turn and see if the code compiles when it is
checked. Or go back to the original database, open its References
dialog, and see which references it is using.
 
D

Dirk Goldgar

amiga1200 said:
When the vlaue is between two items, when I use the subform as a
form, it works, but when it is a subform it keeps crashing Access
2003.

I don't understand your question, or see how it's related to the
BrowseFolder function. To ask an unrelated question, please start a new
thread. Whether or not you start a new thread, please give more details
of what you have done, what your code looks like, and what error
messages, if any, you get.
 

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