473,573 Members | 2,831 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.d ll" Alias _
"GetOpenFileNam eA" (pOpenfilename As OPENFILENAME) As Long

Private Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilt er 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.FileDial og
Dim varDir As Variant
Set dDialog = Application.Fil eDialog(msoFile DialogFolderPic ker)
dDialog.AllowMu ltiSelect = False
dDialog.Title = " Select Directory"
If dDialog.Show = True Then
For Each varDir In dDialog.Selecte dItems
Me!txtPath = varDir
Next
End If
End Sub

Do I need MS's private function?

Thanks in advance.
Nov 13 '05 #1
8 9110
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.c om> wrote in message
news:9P******** *********@newss vr21.news.prodi gy.com...
What is the best way to get a Common Dialog in Access 2000 Standard
Edition?

Microsoft suggests this:

Private Declare Function GetOpenFileName Lib "comdlg32.d ll" Alias _
"GetOpenFileNam eA" (pOpenfilename As OPENFILENAME) As Long

Private Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilt er 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.FileDial og
Dim varDir As Variant
Set dDialog = Application.Fil eDialog(msoFile DialogFolderPic ker)
dDialog.AllowMu ltiSelect = False
dDialog.Title = " Select Directory"
If dDialog.Show = True Then
For Each varDir In dDialog.Selecte dItems
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.c om> wrote in message
news:9P******** *********@newss vr21.news.prodi gy.com...
What is the best way to get a Common Dialog in Access 2000 Standard
Edition?

Microsoft suggests this:

Private Declare Function GetOpenFileName Lib "comdlg32.d ll" Alias _
"GetOpenFileNam eA" (pOpenfilename As OPENFILENAME) As Long

Private Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilt er 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.FileDial og
Dim varDir As Variant
Set dDialog = Application.Fil eDialog(msoFile DialogFolderPic ker)
dDialog.AllowMu ltiSelect = False
dDialog.Title = " Select Directory"
If dDialog.Show = True Then
For Each varDir In dDialog.Selecte dItems
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.c om> wrote in message
news:1R******** *********@newss vr21.news.prodi gy.com...

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
1405
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 change the caption of the 'Open' button in the 'Open File' dialog. Thanks, Gord
3
1908
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 the wizard shuts down. The first, which apprears immediately after starting the wizard is a message box stating something like "the property value is too large". After clicking through and filling...
3
14820
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 trying to declare these functions -- compile error: User-defined type not defined - am I missing a reference? which one? Private Declare Function GetOpenFileName _ Lib "COMDLG32.DLL" Alias...
4
1488
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 your search to receive the information? I've been typing in lots and lots of different keywords, all to no avail. I was needing assistance setting up a common dialog control in my app. I got the...
4
2382
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 installed, the references are hosed and I get unable to find function error. There are no third party controls in the application. This target machine is on a network requiring domain login, but the...
8
5257
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 Default File Format drop down list on the Advanced Tab of the Options dialog? I need to do some quick work for a client that runs Access 2000 and I've only been doing working on 2002/2003 projects...
2
2107
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 the fonts folder and there is so many fonts there. Here is my code: ComDlg.Flags = cdlCFBoth Or cdlCFEffects ComDlg.ShowFont rtfDoc.SelFontName = ComDlg.FontName ...
13
2661
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 one PC each linking to the same back end. Edit a records in one front end and leave it unsaved. Edit the same record in the other front end and save the change. Save the change in the first front...
8
4684
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 thumbnail-view programmatically? Example ?? At the moment I am using Ken Getz' code. at http://www.mvps.org/access/api/api0001.htm Thanks Arno R
0
7755
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7679
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7992
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8190
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8048
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6385
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3722
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1284
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1027
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.