AccessBlog.net

News, links, downloads, tips and tricks on Microsoft Access and related

About Me Search
Alex
Name:Alex Dybenko

Location:Moscow, Russia

Friday, January 27, 2012

How to get most recent DBEngine object

Below is Graham Mandeno's version of  VBA GetDBEngine(), now in VB.NET. If user have several versions of DAO installed this function returns reference to latest available.

 1:  Public Function GetDBEngine() As Object
 2:  Dim aVersions() As String = {"120", "36", "35"}
 3:  Dim i As Integer
 4:  GetDBEngine = Nothing
 5:  Try
 6:   For i = LBound(aVersions) To UBound(aVersions)
 7:    Try
 8:      GetDBEngine = CreateObject("DAO.DBEngine." & _
        aVersions(i))
 9:      Exit For
 10:   Catch ex As Exception When Err.Number = 429
 11:   'continue after "Cannot create ActiveX component"
 12:   Catch
 13:    Throw
 14:   End Try
 15:   If i = UBound(aVersions) Then _ 
        Throw New System.Exception("No known version" & _         " of DAO is available")
 16:   Next
 17:  Catch ex As Exception
 18:   Throw New System.Exception("Cannot create " & _
      "DBEngine" & vbCrLf & ex.Message)
 19:  End Try
 20:  End Function

Labels: , ,

Saturday, January 14, 2012

How to make Windows 8 work for you

These 2 steps you need to do if you want to do some coding/testing on Windows 8, rather than playing with Metro UI.

1. Switch to Window 7 type Start menu
Navigate using RegEdit to: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer
Set registry key RPEnabled to 0

How to get a Windows 7 start menu in Windows 8

2. Disable UAC completely
Navigate using RegEdit to: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
Set registry key EnableLUA to 0

How To (Really) Completely Disable UAC on Windows 7

Labels: