Solved

Windows Explorer

Posted on 1998-09-04
11
198 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
  • 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now