Solved

Common Dialog in Access 97

Posted on 2000-05-22
12
286 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 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

20 Experts available now in Live!

Get 1:1 Help Now