UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Easy Dialog Boxes - Open, Save, Saveas - Class Module, Access 2003    
 
   
merlenicholson
post Feb 24 2015, 11:57 PM
Post#1



Posts: 507
Joined: 23-November 11
From: Tampa, Florida, USA - UTC -5:00


Version: Will work on Access 2003 and up, but 32-bit WIN API only.
Requires Reference: Microsoft Scripting Runtime

This is the standard Dialog box Open, Save and SaveAs except implemented as a Class Module. Once "Set", the module acts like a component with Methods (two) and Properties (Thirteen). It is well documented with two examples and descriptions of all methods and properties.

Why do this, when the same Dialogs are available as toolbar objects? Because this does not need Office installed. Particularly when deploying an Access Runtime application, when there is no guarantee the user will have Office installed. The "standard" Dialog box requires a reference "Microsoft Office xx.x Object Library" that you -and your users- may not have.

A little History: I wrote it about year 2000 for a project in VB5, and it's gone through very few revisions. One is to make it Access-able by making the initial Access application directory the default. That was the only change to convert from VB6 to VBA. Next was to use the function InstrRev because VB5 didn't have that, and recently to use the "Microsoft Scripting Runtime" for FileExists, JoinPathNames and FilePart.
Attached File  DLG.zip ( 4.83K )Number of downloads: 127

I sincerely hope someone will find this useful. Feel free to contact me for any suggestions or help.

Example SaveAs Dialog
CODE
    'Dim D As DLG
    'Dim fn As String
    'Set D = New DLG
    ' ****************************
    'D.DefaultExtension = "csv"
    'D.dlgType = DlgSaveAs
    'D.Filters "Text Files (*.txt;*.csv;*.tab;*.asc)", " *.txt;*.csv;*.tab;*.asc"
    'D.InitDir = Application.CurrentProject.Path
    'D.FileName = "DriverData.csv"
    'D.UseOverWriteFilePrompt = True
    'D.Title = "Save Driver Data As"
    'If D.DialogBox Then
    '    fn = D.FileName
    'Else
    '    MsgBox "File specification not correct", vbInformation + vbOKOnly, "Export DriverData"
    '    DoCmd.SetWarnings True
    '    Set D = Nothing
    '    Exit Sub
    'End If
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    14th December 2017 - 09:45 PM