Home

Access Extra No 23 September 2003_
_aadconsulting.com
     
 What's New

NEW Final Products

The following applications went 'gold' this month:

NEW SmartForm v5.4

New version 5.4 adds the option to code a SmartForm as a subform.

Download SmartForm v5.4

Coming Soon Copy Protector Beta

When I have time, I have been working on a new Access tool: ©MDE Copy Protector. So far, I have a working Beta of the Access97 version.

Copy Protector uses an algorithm to secure an application to a single machine. The current version of Copy Protector does not support secured .mdb’s. An Access .mde copy-protected by Copy Protector queries the machine for a key unique to that machine. If the key value is different from what was expected, the application will not function by not allowing the opening of any form or report.

Office 2003 News

The Office On-Line Web Site showcasing Office 2003 launched on 8 September.

You can register for a Free Microsoft Office System Launch Event. Events begin October 21. Attendees receive a free corporate evaluation kit.

Office 2003 locks down Documents

Office 2003 has tools for limiting access to Office documents: identify who can read or alter a document, block it from copying or printing, and set an expiration date.
Full details

Office Marketplace News

My SmartForm+ Access Add-In was listed on Office Marketplace on
12 September. So, all you users of SmartForm get on to the site and vote for this Add-In! Do a search on "access" to find the listing.

Office Updates

For details on the swathe of recent patches:

Microsoft Office Product Updates

Flaw in Visual Basic for Applications Could Allow Arbitrary Code Execution (822715)

Unchecked buffer in Microsoft Access Snapshot Viewer Could Allow Code Execution (827104)

Buffer Overrun in WordPerfect Converter Could Allow Code Execution (827103)

Flaw in Microsoft Word Could Enable Macros to Run Automatically (827653)

 Tips
TypeName function

The TypeName function returns a String that provides information about a variable.

Syntax: TypeName(varname)

The required varname argument is a Variant containing any variable except a variable of a user-defined type.

More tips, samples, articles & code on the

Access Utilities CD
New v4.0

Custom Message Boxes

The MsgBox function contains an optional argument, Buttons, that allows you to place additional buttons and icons on your message boxes by specifying a vbMsgBoxStyle value:
Public Sub CustomMessageBoxes()

Dim iResponse As Integer

MsgBox Prompt:="Abort/Retry/Ignore (Ignore Default)", Buttons:=vbAbortRetryIgnore + vbDefaultButton3
MsgBox Prompt:="Critical", Buttons:=vbCritical
MsgBox Prompt:="Exclamation", Buttons:=vbExclamation
MsgBox Prompt:="Information", Buttons:=vbInformation
MsgBox Prompt:="OK/Cancel", Buttons:=vbOKCancel
MsgBox Prompt:="Question", Buttons:=vbQuestion
MsgBox Prompt:="Retry/Cancel", Buttons:=vbRetryCancel
MsgBox Prompt:="Yes/No", Buttons:=vbYesNo
MsgBox Prompt:="Yes/No with Information", _
Buttons:=vbYesNo + vbInformation
MsgBox Prompt:="Yes/No with Critical and Help", _
Buttons:=vbYesNo + vbCritical + vbMsgBoxHelpButton

' Determine which button the user selects.
iResponse = MsgBox(Prompt:="Click Yes or No.", _
Buttons:=vbYesNo + vbCritical)
Select Case iResponse
   Case vbYes
      MsgBox Prompt:="You clicked Yes."
   Case vbNo
      MsgBox Prompt:="You clicked No."
End Select

End Sub

SysCmd - A Handy Function

The SysCmd function is very useful and versatile. Look up SysCmd in the Access Help file for pointers on its use.

I recently used a feature of the function to quickly check if a nominated form was open, rather than iterate through the Forms collection. The code is set out below.

I used the following syntax:
ObjectState = SysCmd(action[, objecttype][, objectname]),
where action, is an intrinsic Access constant for a designated action.

Calling the SysCmd function with the acSysCmdGetObjectState action argument and the objecttype and objectname arguments returns the state of the specified database object. An object can be in one of four possible states: not open or non-existent, open, new, or changed but not saved.

Constant Object State
acObjStateOpen Open
acObjStateNew New
acObjStateDirty Changed but not saved

Note If the object is either not open or doesn't exist, the SysCmd function returns a value of zero.

Public Function fnTestStartupFormLoaded() As Boolean
Dim intObjType As Integer
Dim strObjName As String
Dim intObjState As Integer

intObjType = acForm
strObjName = "frmStartUp"
intObjState = SysCmd(acSysCmdGetObjectState, intObjType, strObjName)

If intObjState <> 0 Then
'StartUpForm is loaded
   fnTestStartupFormLoaded = True
Else
'StartUpForm is not loaded
   fnTestStartupFormLoaded = False
   MsgBox "This application is not licensed for this machine." & vbCrLf _
   & vbCr & "Contact " & "the Vendor.", _
   vbCritical + vbOKOnly + vbDefaultButton1, "© MDE Copy Protector"
   Application.CloseCurrentDatabase
End If

Exit Function

End Function
A Fool-proof Way to Add a Library Reference

Those of you who develop Access add-ins or library databases, know that adding a reference to the addin or library database to the user .mdb can be tricky, as the library file may not be where it is expected to be.

I use the following function, which is called each time the library file is loaded and uses the Name property of the CodeDb function to return the full path of the library file:

Private Function aad_AddLibraryReference() As Boolean
On Error GoTo AddLibraryReferenceError

Dim aad_refBuilderLibrary As Reference

Set aad_BuilderLibrary = References.AddFromFile(CodeDb.Name)

aad_AddLibraryReference = True

Exit Function

AddLibraryReferenceError:

If Err = 32813 Then
'Reference already exists
   Resume Next
Else
   MsgBox "Add LibraryDB Reference Error" & Err & ". " & Err.Description  
   aad_AddLibraryReference = False
   Exit Function
End If

End Function
_Downloads

http://www.asken.com.au/downloads/accessdbs1.php

http://www.zada.com.au/accessaddins.htm

http://www.bykeyword.com/

http://www20.brinkster.com/madtx/AccessAdd.htm

http://www.nuclear-diagnostics.com....Add-ins &_Utilities

 Code Samples

imd The Forms Container

Create a new module in Northwinds .mdb, insert the folllowing code (adapted from one of my addins), and run the function, which takes less than a second to do its work:

Public Function aad_fnLoadFormsList()
On Error GoTo LoadFormsListError
              
    Dim aad_db As DAO.Database
    Dim aad_con As Container
    Dim aad_edoc As Document
              
    Set aad_db = CurrentDb()
    Set aad_con = aad_db.Containers!Forms
   
    For Each aad_edoc In aad_con.Documents
        If Left$(aad_edoc.Name, 1) <> "~" Then
            Dim aad_stObjectName As String
            aad_stObjectName = aad_edoc.Name
            Debug.Print aad_stObjectName
                Dim aad_frm As Form
                Dim aad_frmCtl As Control
                Dim aad_stControlList As String
                Dim aad_intIndex As Integer
                DoCmd.OpenForm aad_stObjectName _
               
', acDesign, , , , acHidden
                Set aad_frm = Forms(aad_stObjectName)
                    For aad_intIndex = 0 To aad_frm.Controls.Count - 1
                        Set aad_frmCtl = aad_frm(aad_intIndex)
                        If TypeOf aad_frmCtl Is ComboBox Or _
                        TypeOf aad_frmCtl Is ListBox Then
                            aad_stControlList = vbTab & "Control Name: " _
                        & aad_frmCtl.Name & "; Control Source: " _
                        & aad_frmCtl.ControlSource
                            Debug.Print aad_stControlList
                        End If
                    Next aad_intIndex
                DoCmd.close acForm, aad_stObjectName, acSaveNo
        End If
    Next aad_edoc
           
    aad_fnLoadFormsList = True
   
Exit Function

LoadFormsListError:

aad_fnLoadFormsList = False
MsgBox "Load Forms Error " & Err & ". " & Err.Description
Exit Function

End Function

 Useful links

The Office 2000 Assistance Site
Service packs, Web components, and security information.

Latest Office Resource Kit
Get the latest tools and security patches.

 Coming soon...
  • Access Copy Protector An Access application that copy protects an .mde, so that it will run only on the machine that it is installed on. 
  • Sticky Toolbar - an Access form-based Toolbar that moves with a form.
  Access KB Articles

 

ACC2000:

Q823332 Availability of Access 2000 Post-Service Pack 3 Hotfix Rollup Package: July 8, 2003

Q823336 Availability of Access 2000 Post-Service Pack 3 Hotfix Rollup Package: July 9, 2003

Q821787 You Receive an Error Message When You Overwrite or When You Delete a Kandji + Dakuten (Japanese Voiced Sound Mark) String

Q814093 Access Quits Unexpectedly When Viewing Report Preview

Q207860 Function Called from Command Bar Control Runs Three Times

ACC2002:

Q295251 Access Crashes When You Sort a Table That Has a Subdatasheet

Q821809 Microsoft Access Quits When You Link ODBC Tables

Q823337 Availability of Access 2002 Post-Service Pack 2 Hotfix Rollup Package: July 14, 2003

Q814094 Error Message: Cannot Apply Filter on One or More Fields That Are Specified in the Filter Property

Q302525 "Run-Time Error '3709'" Error Message When You Enter a Large Amount of Text in a Memo Field That Contains an Index

Q295255 "Login Failed for User 'NT AUTHORITY\ANONYMOUS LOGON'." Error When You Try to Link a Table

Q291539 Create and Drop Tables and Relationships Using SQL DDL

Q289681 "File Already in Use" Error Message When You Open a Database That Is Located on a Novell NetWare Server

Q291162 AutoNumber Field Duplicates Previous Values After You Compact and Repair a Database

Q303968 How to Create an SQL Pass-Through Query

Q823808 Availability of the Access 2002 Post-Service Pack 2 Hotfix Package (Japanese): July 18, 2003

_Back Issues

 

Download a Searchable Compendium of Issues 1-12  

Download a .Zip File of All Issues 1-23  

Visit our Link Partner:
Superior Software for Windows
Access, SQLServer and .NET Downloads

www.ssw.com.au
Top

Top

Editor: Tony D'Ambra
CONTENTS:

What's New:
Access Control Center
Ezy SQL

123 Error-Handler
Access Utils CD v4.0
SmartForm 5.4
Access Utils CD v4.0
Copy Protector Beta
------------------------
Office On-Line

Office Marketplace
Office Updates

Tips
TypeName
Custom MsgBoxes

SysCmd
Library References

Downloads
5 New URLs

Code Samples
Forms Container

Useful Links
Office 2000 Assist Site
Latest Office Res Kit

Coming soon...
Copy Protector
Sticky Toolbar

New Access KB Articles
16 New References

Back Issues
#1-22

Link Partners
SSW

Free Subscription

SUBSCRIBE:
To subscribe or unsubscribe from this mailing list, select a choice from combo-box below, enter your e-mail address and click OK:


Have questions or comments?
Send them to me.

This newsletter may contain links to sites or files on the Internet which are owned and operated by third parties. AAD CONSULTING is not responsible for the content of or files from any such third-party site.

Any files are provided "as is", without warranty of any kind. AAD CONSULTING does not assume any liability for use or the consequences of use.

Access is a trademark of Microsoft Corporation.

©2001-2003
Anthony D'Ambra.
All rights reserved.

Top