I needed to write a comaddin to be able to read information from a web service for my Microsoft Access application. In my form_load() sub I have the following code to make sure the addin is loaded and it gets synched up with the controls on the form:
Then I do the following when the form is closed:
Within the addin I've commented out all the calls, other than synching with the controls on the form:
This should be the only code called within the addin if I open the form and then turn right around and close it. If I run from devstudio 2008 in debug mode, Access starts and stops properly but if I run Access directly and open the form then exit Access, Access is still running. Could anyone point me into some things to look for or suggestions on what might be keeping Access running? If I comment out the code in the with/endwith section Access stops properly when I run it directly so I'm not sure what to look at next?
Thanks,
Lution
Code:
With COMAddIns("myAddinName.Connect")
' Make sure the COM add-in is loaded.
.Connect = True
' Hook up the desired objects.
.Object.HookupControls Me.fillCitationsButton, Me.cmdCancel, Me.txtUserName, Me.txtPassword, Me.dbPath, Me.dbName, Me.dbPassword
End With
Code:
Private Sub Form_Close()
With COMAddIns("myAddinName.Connect")
.Connect = False
End With
End Sub
Code:
Public Sub HookupControls( _
ByVal button As Access.CommandButton, _
ByVal button2 As Access.CommandButton, _
ByVal textBox2 As Access.TextBox, _
ByVal textBox3 As Access.TextBox, _
ByVal textBox4 As Access.TextBox, _
ByVal textBox5 As Access.TextBox, _
ByVal textBox6 As Access.TextBox)
fillCitationsButton = button
fillCitationsButton.OnClick = "[Event Procedure]"
cmdCancel = button2
txtUserName = textBox2
txtPassword = textBox3
dbPath = textBox4
dbName = textBox5
dbPassword = textBox6
End Sub
Thanks,
Lution