Bloating Access File Size

Joined
Jul 29, 2009
Messages
1
Reaction score
0
Hi all,

I've created an MS Access Database that imports an Excel file into a table. The data then goes through a few changes so that it will be in the correct form for the rest of the database. My problem is that whenever I run the sub, the file size increases by around 1MB. However, none of my tables/querries are increasing in size. Where/what is being stored and why??

PS. If my SQL is sloppy or inefficient it is because I'm relatively new to using MS Access and all self-taught. :p

Code:
Public Sub IMPORT()
'Imports JDE Excel Spreadsheet into tbl_pkpn
	'DoCmd.SetWarnings False
 
	Dim db As DAO.Database, qdf As DAO.QueryDef
	Dim strExcelPath, strSQL As String
	strExcelPath = "G:\MO\Shannan ALL FOLDERS\PK Database\PKWhereUsed.xls"
	Set db = CurrentDb
	Set qdf = db.QueryDefs("qryPKPN1")
 
	MsgBox "This may take a few minutes. Don't Exit MS Access or 'Break' the program."
 
	Forms!frmdataview.cboSearchPN.RowSource = ""
	Forms!frmdataview.RecordSource = ""
 
	DoCmd.RunSQL "DELETE * FROM tbl_pkpn1 ;"
	DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "tbl_pkpn1", strExcelPath, True
	DoCmd.RunSQL "DELETE FROM tbl_pkpn1 WHERE tbl_pkpn1.[pk] IS NULL ;"
	DoCmd.RunSQL "UPDATE tbl_pkpn1 SET tbl_pkpn1.[pk number] = RIGHT(tbl_pkpn1.[pk], LEN(tbl_pkpn1.[pk]) - 2) ;"
	strSQL = "SELECT DISTINCT tbl_pkpn1.[part number], tbl_pkpn1.[pk], tbl_pkpn1.[pk number] FROM tbl_pkpn1 WHERE " & _
		"LEFT(tbl_pkpn1.[pk],2) = 'PK' AND " & _
		"ISNUMERIC(RIGHT(LEFT(tbl_pkpn1.[pk],6),4)) ;"
	qdf.SQL = strSQL
 
	DoCmd.RunSQL "SELECT * INTO tbl_pkpn FROM qrypkpn1"
	DoCmd.RunSQL "DELETE * FROM tbl_pkpn1"
	Forms!frmdataview.cboSearchPN.RowSource = "SELECT DISTINCT [part number] FROM tbl_pkpn ORDER BY [part number]"
 
	qdf.Close
	db.Close
 
	Set qdf = Nothing
	Set db = Nothing
	DoCmd.SetWarnings True
 
	MsgBox "Import Complete!" & Chr(10) & "Begin P/N to PK table sync."
 
	'Module1.SYNC
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top