Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is this possible? I'd like to view a normal folder from Access 2

Status
Not open for further replies.

0200050

Programmer
Jun 3, 2003
58
FI
Yeah, you got my question, which is somethin you probably(?) won't hear every day(guess) :p

So, because this is totally new to me, I'd like to firstly ask, is this possible to implement with MS Access 2000 at all?

The ideal mechanism of desired function:

User would be able to open some folder from harddisk, and view all those files, and when viewing, he also could open them, but with the programs made to them of course..(For example, .xls-files would open with Excel, so use of OLE-objects not necessary)

So, do you think is this possible, and if it is, how you would start to do it?

Or has someone ever tried similar by himself?

Every suggestion related to this matter will be highly appreciated.

Thank you in advance,

Mike, from Finland



 
Hi jrbarnett, and thanks for very interviewing reply.

That code seems to be bouncing all over the internet, it looks very useful.

It would be useful to me too, if I just knew how to use it. I placed the code into a normal module. But then I'd also like to use the code. Following is something I actually can't handle. Here is the example-line:

Code:
fHandleFile("C:\TEMP\TestThis",Win_Normal)

Which firstly is not acceptable way of calling function.(At least as far as i'm concerned)
I tried to call it from a form, event Form_Load(), just like this:

fHandleFile("D:\Database", WIN_NORMAL)

but here the VBA still wants some value. What may this value be for example,(strResult?) and what should do with it?

 
Are you retrieving the result of the function call?

eg

varResult = fHandleFile("C:\TEMP\TestThis",Win_Normal)

if not, you need to treat it as a sub by removing the brackets, which ignores the result:

fHandleFile "C:\TEMP\TestThis",Win_Normal

John
 
Hello again, i'm still wrestling with the issue...

The line:

fHandleFile "C:\TEMP\TestThis",Win_Normal

Generates always this kind of an error ->
"ByRef argument type mismatch" -> then Access(VBA) points to Win_Normal...

And it seems the line doesn't care of any(at least some) modifications (for example with brackets, without of 'em, and even refering to variable doesn't seem to perform wanted action...).

May there be still something to do to fix this problem?

Mike, finland
 
Always use Option Explicit as it seems Win_Normal is not defined (should be a Long with value 1 )

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
No, unfortunately, when it stopped messaging errors, it didn't do anything. No action at all. I just can't get that working, or there's something mistake i've been making all the time.

But at this far my only question would be, how I could open a .CHM-file by clicking a button in an Access program???

Mike, from Finland
 
You can just invoke a standard File Explorer Window in Access by attaching the following code to a button or whatever:

Dim stAppName As String

stAppName = "explorer ""g:\common\contract analysis\consignments\Data"""
Call Shell(stAppName, vbNormalFocus)

Basically it's just calling the shell program with a string to run, being explorer - you need to use 2 lots of double quotes to tell the VBA interpreter to pass a double quote in, rather than closing off a string. Alternatively, one single quote (') might do the trick instead. Or else substitute in a string variable holding the directory name in case you want to be able to vary it.

Also, there are 'tree' controls available in VBA which would let the user select a directory they want to look at then run File Explorer when they double click a tree item or whatever, if you can figure out how to drive that one...

Cheers,
Sean
 
Wow Sean, Thanks a lot, that did the trick real nicely! Now the folder is really able to be viewed. Thank you so much!

But then what comes to this second problem of mine,(which is a little offtopic, must to admit)do you have any idea how to open a single .chm-file with a button click? When I tried this File Explorer with this issue, it was going to download the file...

Best regards
Mike, Finland
 
Okay, this another thing is now solved too, with this kind of a code:

Code:
Private sub Command1_Click()

Dim ID as Variant

ID = Shell("hh.exe H:\Project\HelpFile.chm", vbMaximizedFocus)

End sub

Original solution of this was found at here:

Thank you for anyone who answered this post!

Cheers,
Mike, Finland
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top