Solved

Windows Explorer

Posted on 1998-09-04
11
200 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

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…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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…

821 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