Solved

Common Dialog in Access 97

Posted on 2000-05-22
12
287 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
 
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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
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 …
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…

911 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

24 Experts available now in Live!

Get 1:1 Help Now