I created an application that connects to an Access database using ADO. The problem I have is: If I use the application's File->Exit menu, the apllication always stays in memory. I have to press ALT-CTRL-DEL to end it's task. If I use the control menu (or the X at the top right corner of the form) I get an application error in Windows and the application terminates abnormally. What could be the problem?
The Database connection is declared in the Declarations area as:
Dim dbConn as New ADODB.Connection
The code in the exit menu is:
My Form_QueryUnlod(Cancel as Integer) event is as follows:
Private Sub Form_QueryUnload(Cancel As Integer)
If MsgBox("Are you sure you want to exit this application?=vbno Then
Cancel = True
The Form_Unload event contains this code:
Private Sub Form_Unload()
Dim f As Form
For Each f in Forms
If f.Name <> Me.Name then Unload f
set dbConn = Nothing
In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function. While writing that article I realized that no o…
Here are a few simple, working, games that you can use as-is or as the basis for your own games.
This is one of the simplest of all games.
The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code.