Solved

Windows Explorer

Posted on 1998-09-04
11
203 Views
Last Modified: 2012-06-21
Can I gain control of Windows exporer for with in access if so how?
0
Comment
Question by:Techs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1961262
What kind of control you want to have? What do you want it to do?
0
 

Expert Comment

by:alex123
ID: 1961263
Try sending keyboard (send key) events to the Explorer. Go to the help file, in the example there is a funtion that allows you to set focus on a application first (unless you are executing it from Access) and then you can start sending keyboard events
0
 

Author Comment

by:Techs
ID: 1961264
I want to gain control of the file browse to select import files. Without going through the access import procedure. The Code on my form is as follows:

Dim stringInput As String, strMsg As String
            On Error GoTo file_not_found
            Const conErrFileNotFound = 3001

        If IsNull(Combo0)
        DisplayMessage "You must enter a something!"
        Exit Sub
        Else
        strMsg = "Enter Full Path, File Name and Extension (ie. C:\Bla\Bla\"File Name.xls)"
        stringInput = InputBox(Prompt:=strMsg, Title:="File Name")
        GoTo Update
       
       
        End If

       
Update:
     If MsgBox(stringInput, vbOKCancel, "Import") = vbOK And strInput > "" Then
        DoCmd.TransferSpreadsheet acImport, 8, "ExcelImport", strInput, True, "Range"
       
     Else
        DisplayMessage "No File Name Or Cancelled!"
       
        End If
        Exit Sub
file_not_found:
    If Err.Number = conErrFileNotFound Then
        DisplayMessage "Can't Find File!"
        Err.Clear
        Else
        MsgBox Err.Description
        End If

End Sub

I want to replace the InputBox(stringInput) with the ability to browse and then select a file.

0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 8

Expert Comment

by:MikeP090797
ID: 1961265
You should use the Common dialog control. I'm not sure how .OCXs are used in access, but if you do, I'll tell you what properties you need to set
0
 

Author Comment

by:Techs
ID: 1961266
I tried that but I can't get the ActiveX common dialog box controls to work in access. I get the message OLE Sever not registered. When I try to install it I get another error message along the lines of you can't install/unistall that control from within access use another program to install/uninsall this control.
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1961267
Go toStart->Run, type:
RegSvr32 c:\windows\system\comdlg32.ocx
{check for the correct name}
0
 

Author Comment

by:Techs
ID: 1961268
There is no file on my system called comdlg32.ocx but there is a file called comdlg32.dll. I tried to register this file with the srever from the run command line but got the following error message. C:\windows\system\comdlg32.dll was loaded, but the DLLRegisterServer entry point was not found.
0
 
LVL 8

Expert Comment

by:Helicopter
ID: 1961269
Unless you are using access 2 you should have comdlg32.ocx This will do exactly what you are trying to do.

If you are using v2 then you can create the dialog in code...let me know. (I'll send you the ocx if you like)
0
 

Author Comment

by:Techs
ID: 1961270
Thanks helicopter.
I am using Office 97. I would like to take you up on your offer of the comdlg32.ocx file as I can't find it on my system or my office 97 CD. The only file I could find was comdlg16.ocx. Perhaps my CD is corrupted. I have been experimenting using a form and programaticly filled list boxes it almost works? If you want to see it let me know.

Regards
Techs

0
 

Author Comment

by:Techs
ID: 1961271
I now have a working copy of comdlg32.ocx. What next?
0
 
LVL 8

Accepted Solution

by:
Helicopter earned 100 total points
ID: 1961272
Put it on a form and call it (e.g.) cdlg

Have a command button with the onclick event code set as:
       Dim strInput As String
       me.cdlg.showopen
 if not isnull(me.cdlg.filename) then      
   strinput=me.cdlg.filename
   DoCmd.TransferSpreadsheet acImport, 8,"ExcelImport",strInput, True, "Range"
end if

That's it, stripped of error handling. You can refine the common dialog to only show files of a certain extension or a default directory etc. but this will take care of the basics.



There is plenty of help on the control but to get to it you need to select a property and press f1. You can also set various properties by right clicking the control and selecting common dialog object/properties

The flags are particularly useful and you should have a look at the various options in help

0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question