Re: CommonDialogs (Access97)

If you're talking about giving the users a File Open/Save dialog they can use to browse to the location to save the file, you can do it with the Common Dialog control or you can use code to call the same dialog without the control. There are several implementations on <A target="_blank" HREF=http://www.mvps.org/access/>The Access Web</A> that use forms and code rather than common dialog controls which you might want to take a look at. Common dialogs are easy to use and work like a charm in VB, but in Access are they are *not* my favorite things.

Re: CommonDialogs (Access97)

>>Common dialogs ... in Access are *not* my favorite things.<<

I'll 2nd that statement! I recently had a situation with a client in which I was having all sort of bizarre behaviour. I eventually removed the Common Dialog control (and removed the reference), and everything cleared up. Even if the form with the control wasn't open, just the existence of the Reference was causing trouble!

Re: CommonDialogs (Access97)

In recent issue of Access-VB-SQL Advisor, Ken Getz presented a class module that duplicated the functionality of the CommonDialog ActiveX control using API. Unfortunately, it requires at least Access2000.

Re: CommonDialogs (Access97)

Here is my solution ... dragged in from the MVP Access website www.mvps.org/access/forms.
I put this into a separate module along with my function named QuerysaveAs.
I called QuerysaveAs from the button on my form.
Within this code I assigned the variable strTargetQuery to the name of the relevent QueryDef which is in turn an argument in the transferspreadsheet command.
I dont why it owrks but it does.

Geof
-----------------------------------------------------------
Option Compare Database
Option Explicit
'***************** Code Start **************
'This code was originally written by Ken Getz.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
' Code courtesy of:
' Microsoft Access 95 How-To
' Ken Getz and Paul Litwin
' Waite Group Press, 1996

Type tagOPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
strFilter As String
strCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
strFile As String
nMaxFile As Long
strFileTitle As String
nMaxFileTitle As Long
strInitialDir As String
strTitle As String
Flags As Long
nFileOffset As Integer
nFileExtension As Integer
strDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type

' The function call filled in the strFileTitle member
' of the structure. You'll have to write special code
' to retrieve that if you're interested.
If fResult Then
' You might care to check the Flags member of the
' structure to get information about the chosen file.
' In this example, if you bothered to pass in a
' value for Flags, we'll fill it in with the outgoing
' Flags value.
If Not IsMissing(Flags) Then Flags = OFN.Flags
ahtCommonFileOpenSave = TrimNull(OFN.strFile)
Else
ahtCommonFileOpenSave = vbNullString
End If
End Function

Function ahtAddFilterItem(strFilter As String, _
strDescription As String, Optional varItem As Variant) As String
' Tack a new chunk onto the file filter.
' That is, take the old value, stick onto it the description,
' (like "Databases"), a null character, the skeleton
' (like "*.mdb;*.mda") and a final null character.