Fordraiders
asked on
Access not closing properly via vb.net: Still in memory
vb.net 2003
Office 2003
Access not closing properly via vb.net.
' Calling from vb.net
Public Sub ExportBrand(ByVal strName As String, ByVal strCat As String)
' CAN USE IF NEEDED 01292007
' long execution go and make excel to visible . false: STRAIGHT CALL TO ACCESS FOR DATA
Dim oAccess As New Microsoft.Office.Interop.A ccess.Appl ication
'Start Access and open the database.
oAccess = CreateObject("Access.Appli cation")
oAccess.Visible = False
oAccess.OpenCurrentDatabas e("C:\dm20 07\SkuCat. mdb", False)
'Run the procedure
' oAccess.DoCmd.RunMacro(mcr Name)
oAccess.Run("CallExportG", strName, strCat) 'Clean-up: Quit Access without saving changes to the database.
' oAccess.CloseCurrentDataba se()
MsgBox("Done Exporting Grainger Brand")
oAccess.Quit()
oAccess = Nothing
End Sub
========================== ========== =========
While in Access this is running and closing:
Public Sub CallExportG(strName As String, strCat As String)
ExportCombo strName, strCat
End Sub
Public Sub ExportCombo(strMfrnam As String, strCat As String)
Dim strSql As String, qd As DAO.QueryDef
Set qd = CurrentDb.QueryDefs("Brand QuerySql")
strSql = "SELECT tblCoreSkuInformation.ITEM , tblCoreSkuInformation.WWGM FRNAME, "
strSql = strSql & "tblCoreSkuInformation.WWG MFRNUM, tblCoreSkuInformation.WWGD ESC, "
strSql = strSql & "tblCoreSkuInformation.RIC HTEXT , tblCoreSkuInformation.SPIN , "
strSql = strSql & "tblCoreSkuInformation.RED BOOKNUM, tblCoreSkuInformation.UOM, tblCoreSkuInformation.[UOM Qty], "
strSql = strSql & "tblCoreSkuInformation.[Cu stomer Willcall Qty], tblCoreSkuInformation.[Cus tomer Ship Qty], "
strSql = strSql & "tblCoreSkuInformation.ALT 1, tblSkuCat.[Segment Name], tblSkuCat.[Category Name]"
strSql = strSql & "FROM tblCoreSkuInformation LEFT JOIN tblSkuCat ON tblCoreSkuInformation.ITEM = tblSkuCat.[Grainger SKU]"
strSql = strSql & "WHERE (((tblCoreSkuInformation.W WGMFRNAME) ='" & strMfrnam & "') AND ((tblSkuCat.[Category Name])='" & strCat & "' ));"
qd.SQL = strSql
DoCmd.TransferSpreadsheet acExport, 8, "BrandQuerySql", "C:\DM2007\Export_Template .xls", True, ""
qd.Close
Set qd = Nothing
End Sub
One instance of Access is still left iin memory after running these routines ??
Office 2003
Access not closing properly via vb.net.
' Calling from vb.net
Public Sub ExportBrand(ByVal strName As String, ByVal strCat As String)
' CAN USE IF NEEDED 01292007
' long execution go and make excel to visible . false: STRAIGHT CALL TO ACCESS FOR DATA
Dim oAccess As New Microsoft.Office.Interop.A
'Start Access and open the database.
oAccess = CreateObject("Access.Appli
oAccess.Visible = False
oAccess.OpenCurrentDatabas
'Run the procedure
' oAccess.DoCmd.RunMacro(mcr
oAccess.Run("CallExportG",
' oAccess.CloseCurrentDataba
MsgBox("Done Exporting Grainger Brand")
oAccess.Quit()
oAccess = Nothing
End Sub
==========================
While in Access this is running and closing:
Public Sub CallExportG(strName As String, strCat As String)
ExportCombo strName, strCat
End Sub
Public Sub ExportCombo(strMfrnam As String, strCat As String)
Dim strSql As String, qd As DAO.QueryDef
Set qd = CurrentDb.QueryDefs("Brand
strSql = "SELECT tblCoreSkuInformation.ITEM
strSql = strSql & "tblCoreSkuInformation.WWG
strSql = strSql & "tblCoreSkuInformation.RIC
strSql = strSql & "tblCoreSkuInformation.RED
strSql = strSql & "tblCoreSkuInformation.[Cu
strSql = strSql & "tblCoreSkuInformation.ALT
strSql = strSql & "FROM tblCoreSkuInformation LEFT JOIN tblSkuCat ON tblCoreSkuInformation.ITEM
strSql = strSql & "WHERE (((tblCoreSkuInformation.W
qd.SQL = strSql
DoCmd.TransferSpreadsheet acExport, 8, "BrandQuerySql", "C:\DM2007\Export_Template
qd.Close
Set qd = Nothing
End Sub
One instance of Access is still left iin memory after running these routines ??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.