Solved

CommonDialog Open file

Posted on 2004-04-05
3
969 Views
Last Modified: 2010-08-05
How do you know if they have pressed cancel?
or closed the box?

Thanx in advance
0
Comment
Question by:intalex
  • 2
3 Comments
 
LVL 19

Expert Comment

by:BrianGEFF719
ID: 10756547
just do this...very simple

commondialog1.showopen
if commondialog1.filename = "" then
 msgbox "You pressed cancel!"
else
 msgbox "You picked: " & commondialog1.filename
end if


simple as that
-brian
0
 
LVL 19

Expert Comment

by:BrianGEFF719
ID: 10756554
the only condition in which Commondialog1.filename = "" is when the user presses cancel, so simply check to see if its empty will let you know if the user hit cancel.


-Brian
0
 
LVL 1

Accepted Solution

by:
burnttime earned 20 total points
ID: 10756644
If you have the commondialog on another form and when you press cancel the result still comes up as the opened path so when you press cancel the result isnt blank renew the ocx i had a problem with that a while back and for some reason that work???

If not just:

CommonDialog.Showopen
If CommonDialog.Filename <> "" Then
' Code here to do what ever with the directory
Else: ' Maybe message box saying error if you need a path
End if
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

831 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