Solved

Windows Explorer

Posted on 1998-09-04
11
199 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

813 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

14 Experts available now in Live!

Get 1:1 Help Now