Solved

Common Dialog in Access 97

Posted on 2000-05-22
12
293 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
[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
  • 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
Independent Software Vendors: 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 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

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
default value of combobox 25 67
Email question 19 83
Microsoft Access 32-bit or 64-bit? 11 50
Combo box with two columns question 7 28
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
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…
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.

734 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