Browse button for an input box?

kupe

Registered User.
Local time
Today, 22:43
Joined
Jan 16, 2003
Messages
462
An input box on a form asks the User which file he wants to import.

Is it possible to put a search/browse facility onto the input box to allow the User to locate and click on the file he wants, please experts?
 
That is very impressive, Mile-O-Phile. Are you a genius, or aren't you?

Is this part of the common dialogue box that comes apparently with VB6? (I'm restricted to Access.) That's a lot of coding - but it's a real bonus for the User. Pity we don't have stars here to heap upon you. Many thanks.
 
kupe said:
Is this part of the common dialogue box that comes apparently with VB6? (I'm restricted to Access.)

Na, the common dialog is part of Windows. You've just got to use an API call to use it.

The code comes from the Microsoft website and is
Article: 303066 - How to use the common Dialog in an Access Database

You should look at the Microsoft Knowledge Base more often, there are loads of examples, tutorials, reports, etc.

Microsoft Knowledge Base
 
I should, and I will. (Often there's not much of a breathing space here to allow for it. But I will. ) Thanks very much for your help, and this link as well. Cheers.
 
Mile-O-Phile Question

Is there an advantage of using the API call over a Common Dialog Box?

I normally use

Dim varFileName As String
cdlOpen.cancelerror =true
varFileName = cdlOpen.FileName

I was just wondering if there is a known problem doing it this way or the way you mentioned is better.

Thanks,

Rube
 
M-o-P, is Rube referring to a VB common dialogue rather than your API? That's a most useful microsoft site you directed me to, by the way. And really pleased to have with dialogue arrangement. Many thanks.
 
kupe said:
M-o-P, is Rube referring to a VB common dialogue rather than your API?

Not a VB common dialog - the ActiveX common dialog.

Here's the same example with the ActiveX Common Dialog control.
 

Attachments

Re: Mile-O-Phile Question

rube said:
Is there an advantage of using the API call over a Common Dialog Box?

I don't know. I would just prefer the API method as I find it easier to import a specific File Handling module into my databases rather than write around an ActiveX control that's scope is the current form.
 
That looks really good, M-o-P. I'm surprised there is so little code compared with the API number. Unfortunately, the command button triggers the error message "ActiveX can't create object".

I can't think what that means. Perhaps it's something I haven't done.

It's really good of you to give this illustration. Thank you. Cheers
 
It most likely means that I have Access 97 and you have Access 2000 or 2002 with an improved ActiveX object.


There's a control on the form (that doesn't show) and I called it ctl.

Delete it and Insert a new ActiveX object (Insert -> ActiveX Object -> Microsoft Common Dialog Control

Call this new control: ctl

Might work...

I suppose that's why the API is better - compatibility with different versions of Access. ;)
 
Good point, and the extra code isn't really against it, I suppose, because you only have to write it once.

What this API dialogue does it is to put the path into the textbox. But can it be made to open the file - or have the path copyable, or perhaps put it into the clipboard as well? I suppose I mean how do you use the result?
 
Yes, Access 2k. I'm amazed a genius like you doesn't have the very very latest - or hasn't been given it for Christmas by Uncle Bill G.
 
kupe said:
Yes, Access 2k. I'm amazed a genius like you doesn't have the very very latest - or hasn't been given it for Christmas by Uncle Bill G.


lol

I have XP at home just don't use it very often. My work uses 97 but we're slowly upgrading to XP.
 
Another astonishing disclosure. This biography of you changes from day to day almost. Many thanks.
 
kupe said:
But can it be made to open the file - or have the path copyable, or perhaps put it into the clipboard as well? I suppose I mean how do you use the result?

You would use it to store the filename and then write code to open the file. Usually you'd filter for file types i.e. Word, Excel, and so you'd know what program to use to open the file via code.
 
I am trying to run the code for the dialog box but am missing the reference to the dialog box library in VB. I have been trying to ad it to no avail. Is this something that can only be used if you have the developer edition of access? I found where you can download the control from at microsoft but it will not let me reference it and I can find it in the windows system32 folder but it will not let me link to that one either. Any help you could give would be great
 
The Common Dialog control can be found under:

Insert -> ActiveX Control ->

Microsoft Common Dialog Control.

Why you'd want to use that when you can call the Common Dialog through Windows (a la the first example on this thread), I don't know.
 

Users who are viewing this thread

Back
Top Bottom