How to refactoring old Access application.
Programmers and user opened Access usually will be surprised - what is this stupid program and how is possible to work inside it? If so, that small notice help you.
-
Access by default has hidden main menu. This is first reason to confuse. To show and unblock main menu need to mark "Display navigation panel" and "Show hidden object".
-
Second big questions - what objects Access stored at all? Really Access application what I see, usually not stored data inside MDB file, usually data is stored in particular SQL server, but Access stored "link to external tables" to that huge data in SQL. And besides ExternalLinks Access stored internal (hidden) table with description of all its object, VB code (forms and modules), user tables (if exists), Reports and stored query to DB. If you will have this important understanding its good point to go ahead.
-
Next big question - how to connect external tables to VB code and access engines? This is third big confuse, because data is connected to Access engine and VB-code by different way. If data stored in external SQL server, it usually connected inside to VB code by this way.
1: Dim Connection As New ADODB.Connection
2: Connection.CursorLocation = adUseClient
3: Connection.Open "Provider=SQLNCLI11;Server=(localdb)\MSSQLLocalDB;Database=mailwork; Trusted_Connection=yes;timeout=30;"
But actually Access engine is connected by file or system DSN, configured in ODBC administrator.
-
Next big question to confuse all users that Access has two version of API 32 and 64 bit, therefore in the beginning of code need to place this declaration. Related of your runtime version one or second line of this definition will be red (unsupported).
1: #If VBA7 Then
2: Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal ms As LongPtr)
3: #Else
4: Private Declare Sub Sleep Lib "kernel32" (ByVal ms as Long)
5: #End If
- Next question to refactoring old Access application - how to export Access forms and automatically convert it to Web or ASP.NET forms. There are some tools for this operation, for example http://www.accessconverter.com/, but I prefer doing this operation manually.
|