Solved

Common Dialog in Access 97

Posted on 2000-05-22
12
291 Views
Last Modified: 2006-11-17
I have used the "Common Dialog" control available in VB 6 to create a "Browse" button to select a file and its path in a volume, and then process (open, etc.) the file. Is possible to do this with Access 97?  
0
Comment
Question by:sergiog62
  • 5
  • 4
  • 2
  • +1
12 Comments
 

Author Comment

by:sergiog62
ID: 2806506
Adjusted points from 30 to 100
0
 
LVL 14

Accepted Solution

by:
mgrattan earned 100 total points
ID: 2835674
Yes, you can do this in Access 97.  You can either use the Microsoft Common Dialog controls (available in Tools, References when you have a code module open) or you can use an API call.  The Microsoft Common Dialog controls are probably a tad easier to use but it requires that each PC be set up with the Reference added in the database via the Tools, References menu while the database is open (this can be done either manually for each PC or via code from within the database itself).

The API call is purely DLL-based.  If you are interested in this method, let me know and I'll post the code.
0
 
LVL 14

Expert Comment

by:mgrattan
ID: 2836015
Here's a link to information and examples for using the Windows API for the File Open/Save common dialog:

http://www.mvps.org/access/api/api0001.htm

This method is my preference since you don't have to worry about configuring individual PC's for the ActiveX reference required for the previously mentioned option.
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 7

Expert Comment

by:Believer
ID: 2836728
I have a utility that I adapted from the Access 97 Developer's Handbook.  There are two forms; each one lets you configure what you want the file dialog box to look like, then test the way it works.  When you are done configuring the dialog box the way you like it, you can pop up the code and cut & paste it to your program.
One of the forms uses the ActiveX control and the other uses an API-like hook to msaccess.exe (so you don't have to register any separate controls).  There *are* differences between the approaches, but this will let you see what they are and decide which way to go.
If you'd like a copy of the utility, just post your e-mail address and I'll shoot it to you...

By the way... Welcome to EE!
0
 

Expert Comment

by:ajamil
ID: 2837360
i asked a similar question the other day, here's the response i got...

I think you could use MS Common Dialog ActiveX control to populate and select the picture for hyperlink field. You can add it selecting from menu -> Insert | ActiveX Control...

Then you could add a button next to hyperlink field and have this kind of code in the OnClick event:

Private Sub B_DefineUrl_Click()

    On Error Resume Next
     
    ' ActiveX Control in the form
    ' is named CommonDialog1
    ' txtURL is the hyperlink field textbox

    With Me.CommonDialog1
        .InitDir = "C:\data"
        .Filename = Me![txtURL]
        .CancelError = True
        .ShowOpen
         
        ' check that cancel button was not pressed
        If Err.Number <> cdlCancel Then
            ' build the hyperlink address to URL field
            Me![txtURL] = .Filename & "#" & .Filename & "#"
        End If
    End With
     
End Sub

0
 

Author Comment

by:sergiog62
ID: 2852989
Comment accepted as answer
0
 

Author Comment

by:sergiog62
ID: 2852990
Thank you very much for your suggestions. I am going to prove the two methods, although I at the moment don't have VB in my home PC and I don't have the available control Common Dialog in Access 97. I have installed MS Office 97 Professional Edition; could the Common Dialog be available in this version, and how can I open it an include in my form?). I am interested in the development of applications with Access and Visual Basic. Until now I have created simple data bases in Access and I have modified an existent base in my work. I have written a few code in VB. I have many to learn in VB and everything about API. Of course I am interested in the method using API, and I will thank you if  could send me it. My e-mail addresses:

sgelati@telecompersonal.com.ar or sergiog62@radar.com.ar

I find EE a very interesting site, which I knew by Argentinean magazine "PC Users" and I would like  collaborating with EE.
Dear friend, many thanks and until te next time.
Sergio
0
 
LVL 14

Expert Comment

by:mgrattan
ID: 2852998
sergiog62:  glad I could help you out.  Perhaps you didn't notice that I posted more information earlier that included a link to sample code for the API call.  Here is the link again:

http://www.mvps.org/access/api/api0001.htm 

You can copy and paste the code from this linked web page into a code module in your database and use it to open the File Open/Save common dialog box.
0
 
LVL 14

Expert Comment

by:mgrattan
ID: 2853010
I know it looks like a lot of code in the sample but once you copy it into a code module all you need to do is call the GetOpenFile() function to open the dialog box.  For example, create a Browse button and call it cmdBrowse.  Now, let's say you want the file name to appear in another text box on your form and the text box is called txtFileName:

Sub cmdBrowse_Click()

   Me!txtFileName = GetOpenFile()

End Sub

That's it!
0
 

Author Comment

by:sergiog62
ID: 2853039
Thank you very much, mgrattan! I watched quickly this sample code and I will try it. Wow! It seems a hard work! Also many thanks to believer and ajamil, good answers! By the way, is it possible to e-mail an EE member through the EE site?
0
 
LVL 14

Expert Comment

by:mgrattan
ID: 2854015
<<By the way, is it possible to e-mail an EE member through the EE site?>>

If you click the member's name you should be able to see their profile--the e-mail address is usually mentioned in each person's profile unless that member has decided not to make it public.
0
 
LVL 7

Expert Comment

by:Believer
ID: 2859200
Unfortunately, I 've found that most members do not post an e-mail address.  In fact, most have nothing in their profile; just haven't taken time to enter one I guess.
A while back I posted as suggestion to EE that would enable us to e-mail eachother without knowing a members' e-mail address.  An html interface would be used to key the message and EE would send it to the same e-mail address that EE sends question updates to.  If I remember correctly, it's on the list for consideration.  That was a whilke ago, though, so maybe they need a friendly reminder :-)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

820 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