Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Common Dialog in Access 97

Posted on 2000-05-22
12
Medium Priority
?
302 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 400 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

610 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