472,331 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,331 software developers and data experts.

Common Dialog in Access 2000

What is the best way to get a Common Dialog in Access 2000 Standard Edition?

Microsoft suggests this:

Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias _
"GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long

Private Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type

(See: http://support.microsoft.com/default...b;en-us;303066)

In Access 2003 I was using this:

Private Sub Browse(strTag As String)
Dim dDialog As Office.FileDialog
Dim varDir As Variant
Set dDialog = Application.FileDialog(msoFileDialogFolderPicker)
dDialog.AllowMultiSelect = False
dDialog.Title = " Select Directory"
If dDialog.Show = True Then
For Each varDir In dDialog.SelectedItems
Me!txtPath = varDir
Next
End If
End Sub

Do I need MS's private function?

Thanks in advance.
Nov 13 '05 #1
8 9024
You will also find an example for that here:
http://www.mvps.org/access/api/api0001.htm

The advantage of the longer method is that it calls the Windows API and so
should always work. Calling the Office Dialog could cause a problem if you
have mixed versions of Office. As you may have noticed, in order to get the
Office Dialog to work you had to set a reference to "Microsoft Office 11.0
Object Library". This is version specific. Moving up a version usually isn't
a problem, but if you try to open your file on an older version of Access
that supports your file format, this is likely to break and you'll have to
go into the references dialog to manually set it to the older library. Also,
if you are creating MDE files, you'll have to reset this for the version of
Access the MDE is going to be created in, before creating the MDE. This is
one of the reasons and MDE has to be created on the same version of Access
that it is going to be run on.

--
Wayne Morgan
MS Access MVP
"deko" <de**@hotmail.com> wrote in message
news:9P*****************@newssvr21.news.prodigy.co m...
What is the best way to get a Common Dialog in Access 2000 Standard
Edition?

Microsoft suggests this:

Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias _
"GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long

Private Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type

(See: http://support.microsoft.com/default...b;en-us;303066)

In Access 2003 I was using this:

Private Sub Browse(strTag As String)
Dim dDialog As Office.FileDialog
Dim varDir As Variant
Set dDialog = Application.FileDialog(msoFileDialogFolderPicker)
dDialog.AllowMultiSelect = False
dDialog.Title = " Select Directory"
If dDialog.Show = True Then
For Each varDir In dDialog.SelectedItems
Me!txtPath = varDir
Next
End If
End Sub

Do I need MS's private function?

Thanks in advance.

Nov 13 '05 #2
DFS
Wayne Morgan wrote:
You will also find an example for that here:
http://www.mvps.org/access/api/api0001.htm

The advantage of the longer method is that it calls the Windows API
and so should always work. Calling the Office Dialog could cause a
problem if you have mixed versions of Office. As you may have
noticed, in order to get the Office Dialog to work you had to set a
reference to "Microsoft Office 11.0 Object Library". This is version
specific. Moving up a version usually isn't a problem, but if you try
to open your file on an older version of Access that supports your
file format, this is likely to break and you'll have to go into the
references dialog to manually set it to the older library. Also, if
you are creating MDE files, you'll have to reset this for the version
of Access the MDE is going to be created in, before creating the MDE. This is one of the reasons and MDE has to be created on the same
version of Access that it is going to be run on.
Doesn't have to be. I created and delivered an Access 2000 .mde that ran
fine on Access 2003 when my clients upgraded.

"deko" <de**@hotmail.com> wrote in message
news:9P*****************@newssvr21.news.prodigy.co m...
What is the best way to get a Common Dialog in Access 2000 Standard
Edition?

Microsoft suggests this:

Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias _
"GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long

Private Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type

(See: http://support.microsoft.com/default...b;en-us;303066)

In Access 2003 I was using this:

Private Sub Browse(strTag As String)
Dim dDialog As Office.FileDialog
Dim varDir As Variant
Set dDialog = Application.FileDialog(msoFileDialogFolderPicker)
dDialog.AllowMultiSelect = False
dDialog.Title = " Select Directory"
If dDialog.Show = True Then
For Each varDir In dDialog.SelectedItems
Me!txtPath = varDir
Next
End If
End Sub

Do I need MS's private function?

Thanks in advance.

Nov 13 '05 #3
Wayne Morgan wrote:
You will also find an example for that here:
http://www.mvps.org/access/api/api0001.htm

The advantage of the longer method is that it calls the Windows API and so
should always work.


Indeed it does. I used the above code in Access 97 and it ported to
Access 2003 with no difficulty whatsoever, no changes or tweaking required.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Nov 13 '05 #4
Thanks, again though you were moving up to a newer version. Also, were you
using the runtime version of Access or the full version on the clients'
machines?

--
Wayne Morgan
MS Access MVP
"DFS" <no****@DFS.com> wrote in message
news:ap******************@fe02.lga...

Doesn't have to be. I created and delivered an Access 2000 .mde that ran
fine on Access 2003 when my clients upgraded.

Nov 13 '05 #5
DFS
Wayne Morgan wrote:
Thanks, again though you were moving up to a newer version. Also,
were you using the runtime version of Access or the full version on
the clients' machines?
Full version. In fact, I believe the default file format is Access 2000
when Access 2003 is installed. I know I've seen that on several machines.
Maybe that's only upgrades?



"DFS" <no****@DFS.com> wrote in message
news:ap******************@fe02.lga...

Doesn't have to be. I created and delivered an Access 2000 .mde
that ran fine on Access 2003 when my clients upgraded.

Nov 13 '05 #6
> The advantage of the longer method is that it calls the Windows API and so
should always work. Calling the Office Dialog could cause a problem if you
have mixed versions of Office. As you may have noticed, in order to get the Office Dialog to work you had to set a reference to "Microsoft Office 11.0
Object Library". This is version specific. Moving up a version usually isn't a problem, but if you try to open your file on an older version of Access
that supports your file format, this is likely to break and you'll have to
go into the references dialog to manually set it to the older library. Also, if you are creating MDE files, you'll have to reset this for the version of Access the MDE is going to be created in, before creating the MDE. This is
one of the reasons and MDE has to be created on the same version of Access
that it is going to be run on.


I think the Office Dialog is clearly better. Sort of like .NET - if MS
wants to abstract the API and make it easier for me, great. The more
productive and less arcane this business is the happier I am. But from a
manager's perspective, the API is clearly a better solution. I guess it
depends on how much control you have over your environment (which is usually
not much).

As an aside, you mention that "Moving up a version usually isn't a
problem..." I assume this the case for other references as well - e.g.
Excel, Internet Controls, Scripting Runtime. I'm thinking about my early
bound automation code and know from experience the unpredictable results
caused by broken references.
Nov 13 '05 #7
You're correct about the default file version, it is the 2000 file version
for Access 2000, 2002, and 2003. I believe that the problem comes in with
the "Microsoft Access x.x Object Library" and the runtime version. The
runtime is more restrictive in what it will let you do and I suspect that it
won't let the object library reference upgrade itself. I would have to
reinstall the older version to test this though. It should be testable by
creating and MDE in Access 2000 and opening it with Access 2003 using the
/runtime switch.

--
Wayne Morgan
MS Access MVP
"DFS" <no****@DFS.com> wrote in message
news:52******************@fe02.lga...

Full version. In fact, I believe the default file format is Access 2000
when Access 2003 is installed. I know I've seen that on several machines.
Maybe that's only upgrades?

Nov 13 '05 #8
Yes, I've run across this with Excel also. I can take a '97 Excel spread
sheet to a machine with Excel 2003 installed. If I open the spreadsheet on
that machine then take it back to the machine with Excel 97, the code will
error out until I reset the object libraries to the '97 versions. The DAO
library usually stays put (the newer machine has the old library available),
it's the Excel library that is usually the problem.

--
Wayne Morgan
MS Access MVP
"deko" <de**@hotmail.com> wrote in message
news:1R*****************@newssvr21.news.prodigy.co m...

As an aside, you mention that "Moving up a version usually isn't a
problem..." I assume this the case for other references as well - e.g.
Excel, Internet Controls, Scripting Runtime. I'm thinking about my early
bound automation code and know from experience the unpredictable results
caused by broken references.

Nov 13 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Gord | last post by:
Hello, Does anyone know how to access the caption property on a command button within the common dialog control? Specificaly, I'm trying to...
3
by: Stephen Bishop | last post by:
Hi everyone, In using the SQL Server Database Wizard in Access 2000 to create a new access project, I get two consecutive error messages and then...
3
by: deko | last post by:
I need to use the Common Dialog box, but I'm having trouble getting started. Bear with me as this is new ground for me... First, I get an error...
4
by: Ron Nolan | last post by:
Re: Access 2000 Has anyone been able to find information in the online help on the topic of "Common Dialog Control? If so, what did you type in...
4
by: Barry Young | last post by:
I have Access 2000 installed on a machine and I create the MDE just fine. When I copy the MDE file over to another machine that has Access 2000...
8
by: deko | last post by:
Is it possible to develop an Access app in Access 2003 that will run on Access 2000? Is it just a matter of selecting "Access 2000" from the...
2
by: gazelle04 | last post by:
I have an error using the Common Dialog Box control. I got an error that says "No fonts installed. Open Control Panel to install fonts.". I checked...
13
by: Owen Jenkins | last post by:
Following on from an earlier post... I can reliably corrupt a record by doing the following ... Open two separate but identical front ends on...
8
by: Arno R | last post by:
Hi all. When I need to search for pictures, I always have too choose thumbnail-view manually. Is it possible to open the common dialog in...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.