Solved

Windows Explorer

Posted on 1998-09-04
11
201 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Omit After Update event 5 41
SQL Server 2005 running VERY slow on Virtual Machine 18 62
Access Need to add combo box to sub form 10 46
Reoccurring Access Query 24 39
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

738 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