Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to close MS access?

Status
Not open for further replies.

101287

MIS
Apr 8, 2006
189
US
I have the following code and would like to be able to close access once the script has run. However, I'm not able to figure out the code that I need to add to close it.

Can someone help me how to accomplish this?

Thank you for collaboration.

Luis

++++++++++++++++++++++++++++++++++++++++++++++++++++
Function loadToAccess(newTap)
PathName = \\ftwgroups\jsf\jsfitcoord\FILES_FROM_INTEGRATION_DECK\Account_Mgr_Resources\IT PLANNING\2008 REVIEW FOR 2009 REQUIREMENTS\REQUIREMENTS FOR 2009.xls"
PathName = "c:\REQUIREMENTS FOR 2009.xls"
GetDbPath_Fx = "C:\"
'strDbName = GetDBPath_FX & "xpLRTactical DashBoard.mdb"
strDbName = GetDbPath_Fx & "ThisOne2007LRTactical DashBoardv1.mdb"
Dim acc As New Access.Application
Dim accAutoSec As MsoAutomationSecurity
On Error GoTo Errorhandler
'Capture current security setting
accAutoSec = acc.AutomationSecurity
'Reset the security to low temporarily to avoid the security warning
acc.AutomationSecurity = msoAutomationSecurityLow
'Open the database
acc.OpenCurrentDatabase strDbName, False, "mypassword"

strQry = "Delete * from amReqXreftlb"
With acc.CurrentDb
.Execute (strQry)
.TableDefs.Refresh
End With

acc.DoCmd.TransferSpreadsheet , acSpreadsheetTypeExcel9, TableName:="amReqXreftlb", Filename:=PathName, HasFieldNames:=True
Set acc = Nothing
acc.Quit
Exit_Sub:
Exit Function
Errorhandler:
If Err.Number <> 0 Then
MsgBox Err.Description, vbOKOnly, "Error"
Resume Exit_Sub
End If
End Function
 
Replace this:
Set acc = Nothing
acc.Quit
with this:
acc.Quit
Set acc = Nothing

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top