Browse for Folder API function

M

Michael Daly

I am using a "Browse for Folder" API function (from
http://www.mvps.org/access/api/api0002.htm) to enable
users to navigate around to change folders. This part is
fantastic.

The trouble is how can I pass to this function
the 'default' path (such as c:\data\access) I am using
rather than the Browse for Folder function always starting
at My Computer?

Thanks.

Michael Daly
22 Sept 2003
 
M

Michael Daly

Stephan

Thanks very much for your reply. I'm a fan of your
excellent site.

One question: When I move the code to the class module as
recommended in the code from your site, and I try
to 'Compile and Save' I get an error "Sub or Function not
defined"

How do you reference a function in a class module?

Thanks again.

Michael Daly
22 Sept 2003
 
S

Stephen Lebans

Not sure where you are having a problem Michael. Did you look at the
code behind the sample Form? IT is the 2 public functions,
BrowseForFolderByPIDL and GetPIDLFrom Path that must reside in the
calling Form's class module just as they are in the sample Form. Make
sure you place these 2 functions directly behind any form calling these
functions. The other 2 code modules, modCallBacks and modFileNameDialog
are standard code modules, just import them into your own app.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
M

Michael Daly

Stephan

I am only using the 'BrowseForFolderByPath' function, and
not the BrowseForFolderByPIDL function (which as I
understood was an alternative method to achieve the
functionality of opening a Browse for Folder at a specific
folder). When i put the 'BrowseForFolderByPath' function
in a class module and tried to compile it, an error was
returned that the calling reference ([cmdBrowse] in my
form) couldn't find this function. I then put this
function back into the form code with my [Browse] button,
and it worked fine. Is this dangerous (i.e. Likely to
cause GPF's)? p.s. I deleted the BrowseForFolderByPIDL
function, as I wasn't using it.

Since your last reply I have put the 'GetPIDLFromPath'
function in a class module, and it's working okay. I am
assuming I should also be putting
the 'BrowseForFolderByPath' function also in this class
module??

Thanks again for your help.

Michael Daly
 
M

Michael Daly

Stephan

I have cut and pasted the working code of
the 'BrowseForFolderByPath' function from my form and
pasted it into the class module with the 'GetPIDLFromPath'
function code. When I try to 'Compile and Save' my work I
receive a Compile error -> Sub or Function not defined.
When I click the [Ok] button the function reference
to 'BrowseForFolderByPath' function in my cmdBrowse_Click
form code is highlighted.

Why can't you reference these class functions from within
form code??? (According to the help file, module and class
function are available from anywhere within my code.)

I await your reply.

Thanks.

Michael Daly
-----Original Message-----
Stephan

I am only using the 'BrowseForFolderByPath' function, and
not the BrowseForFolderByPIDL function (which as I
understood was an alternative method to achieve the
functionality of opening a Browse for Folder at a specific
folder). When i put the 'BrowseForFolderByPath' function
in a class module and tried to compile it, an error was
returned that the calling reference ([cmdBrowse] in my
form) couldn't find this function. I then put this
function back into the form code with my [Browse] button,
and it worked fine. Is this dangerous (i.e. Likely to
cause GPF's)? p.s. I deleted the BrowseForFolderByPIDL
function, as I wasn't using it.

Since your last reply I have put the 'GetPIDLFromPath'
function in a class module, and it's working okay. I am
assuming I should also be putting
the 'BrowseForFolderByPath' function also in this class
module??

Thanks again for your help.

Michael Daly

-----Original Message-----
Not sure where you are having a problem Michael. Did you look at the
code behind the sample Form? IT is the 2 public functions,
BrowseForFolderByPIDL and GetPIDLFrom Path that must reside in the
calling Form's class module just as they are in the sample Form. Make
sure you place these 2 functions directly behind any
form
calling these
functions. The other 2 code modules, modCallBacks and modFileNameDialog
are standard code modules, just import them into your
own
app.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.




.
.
 
S

Stephen Lebans

Michael I have mentioned a couple fo times that the 2 functions must
reside in the form's Class module exactly as they are in the sample
Form. If you wish to move them somewhere else, to another seperate class
module or a standard code module, then I am afraid you are on your own.

Good Luck with your project.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Michael Daly said:
Stephan

I have cut and pasted the working code of
the 'BrowseForFolderByPath' function from my form and
pasted it into the class module with the 'GetPIDLFromPath'
function code. When I try to 'Compile and Save' my work I
receive a Compile error -> Sub or Function not defined.
When I click the [Ok] button the function reference
to 'BrowseForFolderByPath' function in my cmdBrowse_Click
form code is highlighted.

Why can't you reference these class functions from within
form code??? (According to the help file, module and class
function are available from anywhere within my code.)

I await your reply.

Thanks.

Michael Daly
-----Original Message-----
Stephan

I am only using the 'BrowseForFolderByPath' function, and
not the BrowseForFolderByPIDL function (which as I
understood was an alternative method to achieve the
functionality of opening a Browse for Folder at a specific
folder). When i put the 'BrowseForFolderByPath' function
in a class module and tried to compile it, an error was
returned that the calling reference ([cmdBrowse] in my
form) couldn't find this function. I then put this
function back into the form code with my [Browse] button,
and it worked fine. Is this dangerous (i.e. Likely to
cause GPF's)? p.s. I deleted the BrowseForFolderByPIDL
function, as I wasn't using it.

Since your last reply I have put the 'GetPIDLFromPath'
function in a class module, and it's working okay. I am
assuming I should also be putting
the 'BrowseForFolderByPath' function also in this class
module??

Thanks again for your help.

Michael Daly

-----Original Message-----
Not sure where you are having a problem Michael. Did you look at the
code behind the sample Form? IT is the 2 public functions,
BrowseForFolderByPIDL and GetPIDLFrom Path that must reside in the
calling Form's class module just as they are in the sample Form. Make
sure you place these 2 functions directly behind any
form
calling these
functions. The other 2 code modules, modCallBacks and modFileNameDialog
are standard code modules, just import them into your
own
app.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Stephan

Thanks very much for your reply. I'm a fan of your
excellent site.

One question: When I move the code to the class module as
recommended in the code from your site, and I try
to 'Compile and Save' I get an error "Sub or Function not
defined"

How do you reference a function in a class module?

Thanks again.

Michael Daly
22 Sept 2003


-----Original Message-----
See:
http://www.lebans.com/callbackbrowser.htm
Bug Fix! June 13/2003 The calling functions must reside
in the Form's
Class module or you will GPF at intermittent times.
Thanks to Richard
Bernstein for the head up!

Functions to allow you to specify the opening folder to
be displayed
when calling the Browser Folder Dialog window. Also allow
you to specify
position for the standard windows File Dialog to open at:

Adapted from a sample here:

http://www.mvps.org/vbnet/index.html?
code/callback/browsecallback.htm

A2KCallbackBrowse.zip - For A2K or higher

A97CallBackBrowse.zip - For A97



--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can
benefit.


message
I am using a "Browse for Folder" API function (from
http://www.mvps.org/access/api/api0002.htm) to enable
users to navigate around to change folders. This part is
fantastic.

The trouble is how can I pass to this function
the 'default' path (such as c:\data\access) I am using
rather than the Browse for Folder function always
starting
at My Computer?

Thanks.

Michael Daly
22 Sept 2003

.


.
.
 
M

Michael Daly

Thanks Stephan for All your help.

It is much appreciated.

Sincerely

Michael Daly

-----Original Message-----
Michael I have mentioned a couple fo times that the 2 functions must
reside in the form's Class module exactly as they are in the sample
Form. If you wish to move them somewhere else, to another seperate class
module or a standard code module, then I am afraid you are on your own.

Good Luck with your project.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Stephan

I have cut and pasted the working code of
the 'BrowseForFolderByPath' function from my form and
pasted it into the class module with the 'GetPIDLFromPath'
function code. When I try to 'Compile and Save' my work I
receive a Compile error -> Sub or Function not defined.
When I click the [Ok] button the function reference
to 'BrowseForFolderByPath' function in my cmdBrowse_Click
form code is highlighted.

Why can't you reference these class functions from within
form code??? (According to the help file, module and class
function are available from anywhere within my code.)

I await your reply.

Thanks.

Michael Daly
-----Original Message-----
Stephan

I am only using the 'BrowseForFolderByPath' function, and
not the BrowseForFolderByPIDL function (which as I
understood was an alternative method to achieve the
functionality of opening a Browse for Folder at a specific
folder). When i put the 'BrowseForFolderByPath' function
in a class module and tried to compile it, an error was
returned that the calling reference ([cmdBrowse] in my
form) couldn't find this function. I then put this
function back into the form code with my [Browse] button,
and it worked fine. Is this dangerous (i.e. Likely to
cause GPF's)? p.s. I deleted the BrowseForFolderByPIDL
function, as I wasn't using it.

Since your last reply I have put the 'GetPIDLFromPath'
function in a class module, and it's working okay. I am
assuming I should also be putting
the 'BrowseForFolderByPath' function also in this class
module??

Thanks again for your help.

Michael Daly


-----Original Message-----
Not sure where you are having a problem Michael. Did you
look at the
code behind the sample Form? IT is the 2 public functions,
BrowseForFolderByPIDL and GetPIDLFrom Path that must
reside in the
calling Form's class module just as they are in the
sample Form. Make
sure you place these 2 functions directly behind any form
calling these
functions. The other 2 code modules, modCallBacks and
modFileNameDialog
are standard code modules, just import them into your own
app.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can
benefit.


message
Stephan

Thanks very much for your reply. I'm a fan of your
excellent site.

One question: When I move the code to the class module
as
recommended in the code from your site, and I try
to 'Compile and Save' I get an error "Sub or Function
not
defined"

How do you reference a function in a class module?

Thanks again.

Michael Daly
22 Sept 2003


-----Original Message-----
See:
http://www.lebans.com/callbackbrowser.htm
Bug Fix! June 13/2003 The calling functions must reside
in the Form's
Class module or you will GPF at intermittent times.
Thanks to Richard
Bernstein for the head up!

Functions to allow you to specify the opening
folder
to
be displayed
when calling the Browser Folder Dialog window. Also
allow
you to specify
position for the standard windows File Dialog to open
at:

Adapted from a sample here:

http://www.mvps.org/vbnet/index.html?
code/callback/browsecallback.htm

A2KCallbackBrowse.zip - For A2K or higher

A97CallBackBrowse.zip - For A97



--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can
benefit.


message
I am using a "Browse for Folder" API function (from
http://www.mvps.org/access/api/api0002.htm) to enable
users to navigate around to change folders. This
part is
fantastic.

The trouble is how can I pass to this function
the 'default' path (such as c:\data\access) I am
using
rather than the Browse for Folder function always
starting
at My Computer?

Thanks.

Michael Daly
22 Sept 2003

.


.

.

.
 
M

Michael Daly

Stephan

I have had a major discovery (for me). I have found out
why I was having so much trouble with putting the code in
the Class module as instructed.

I am running Access 97 in a Windows 98 system.

I saved the new Class module 'clsBrowseFolder'.

In the Command1_Click module in the frmCallbacks form (and
Command2_Click) I had to make some modifications as
follows:

Private Sub Command1_Click()

Dim spath As String
Dim lvCls As New clsBrowseFolder '- New line


Text2.Value = ""

'The call can not have a trailing slash, so
'strip it from the path if present
spath = lvCls.UnqualifyPath((Text1.Value)) '- Modified
line

'call the function, returning the path
'selected (or blank if cancelled)
Text2.Value = lvCls.BrowseForFolderByPath(spath,
Me.hWnd) '- Modified line

End Sub

I added in one new line of code to reference the new class
object created, and then modified two other lines.

Your program works fine now on my system with the new
class module, and no compile errors.

Thank you again.

Michael Daly

p.s. Do you know how to centre the 'Browse for Folder'
form on the screen for the Callback function?

regards... Michael Daly
24 Sept 2003

-----Original Message-----
Michael I have mentioned a couple fo times that the 2 functions must
reside in the form's Class module exactly as they are in the sample
Form. If you wish to move them somewhere else, to another seperate class
module or a standard code module, then I am afraid you are on your own.

Good Luck with your project.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Stephan

I have cut and pasted the working code of
the 'BrowseForFolderByPath' function from my form and
pasted it into the class module with the 'GetPIDLFromPath'
function code. When I try to 'Compile and Save' my work I
receive a Compile error -> Sub or Function not defined.
When I click the [Ok] button the function reference
to 'BrowseForFolderByPath' function in my cmdBrowse_Click
form code is highlighted.

Why can't you reference these class functions from within
form code??? (According to the help file, module and class
function are available from anywhere within my code.)

I await your reply.

Thanks.

Michael Daly
-----Original Message-----
Stephan

I am only using the 'BrowseForFolderByPath' function, and
not the BrowseForFolderByPIDL function (which as I
understood was an alternative method to achieve the
functionality of opening a Browse for Folder at a specific
folder). When i put the 'BrowseForFolderByPath' function
in a class module and tried to compile it, an error was
returned that the calling reference ([cmdBrowse] in my
form) couldn't find this function. I then put this
function back into the form code with my [Browse] button,
and it worked fine. Is this dangerous (i.e. Likely to
cause GPF's)? p.s. I deleted the BrowseForFolderByPIDL
function, as I wasn't using it.

Since your last reply I have put the 'GetPIDLFromPath'
function in a class module, and it's working okay. I am
assuming I should also be putting
the 'BrowseForFolderByPath' function also in this class
module??

Thanks again for your help.

Michael Daly


-----Original Message-----
Not sure where you are having a problem Michael. Did you
look at the
code behind the sample Form? IT is the 2 public functions,
BrowseForFolderByPIDL and GetPIDLFrom Path that must
reside in the
calling Form's class module just as they are in the
sample Form. Make
sure you place these 2 functions directly behind any form
calling these
functions. The other 2 code modules, modCallBacks and
modFileNameDialog
are standard code modules, just import them into your own
app.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can
benefit.


message
Stephan

Thanks very much for your reply. I'm a fan of your
excellent site.

One question: When I move the code to the class module
as
recommended in the code from your site, and I try
to 'Compile and Save' I get an error "Sub or Function
not
defined"

How do you reference a function in a class module?

Thanks again.

Michael Daly
22 Sept 2003


-----Original Message-----
See:
http://www.lebans.com/callbackbrowser.htm
Bug Fix! June 13/2003 The calling functions must reside
in the Form's
Class module or you will GPF at intermittent times.
Thanks to Richard
Bernstein for the head up!

Functions to allow you to specify the opening
folder
to
be displayed
when calling the Browser Folder Dialog window. Also
allow
you to specify
position for the standard windows File Dialog to open
at:

Adapted from a sample here:

http://www.mvps.org/vbnet/index.html?
code/callback/browsecallback.htm

A2KCallbackBrowse.zip - For A2K or higher

A97CallBackBrowse.zip - For A97



--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can
benefit.


message
I am using a "Browse for Folder" API function (from
http://www.mvps.org/access/api/api0002.htm) to enable
users to navigate around to change folders. This
part is
fantastic.

The trouble is how can I pass to this function
the 'default' path (such as c:\data\access) I am
using
rather than the Browse for Folder function always
starting
at My Computer?

Thanks.

Michael Daly
22 Sept 2003

.


.

.

.
 

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