using VB to do data manipulation problem

My program is to use VB to do some data manipulation in Access database. What I did in VB code is simply run some predefined macros.(such as import text file into access table and export).Also, using DAO to execute some sql command. Sometimes, while the program runs, it has error message such as: the access database doesn't response, switch to it? Does anyone know what cause this kind of error?  Could be the database getting too big? What is size limitation for Access database?
Also, by the time, the database grows very big, I do some delete to clean up. After executing the 'delete' command, I suppose to compact the database. Should I use the compact method in VB? Or is there better way to do it? since the compact command requires to create a new DB based on old DB. I want to simply compact the old db in the VB code. Any suggestion?
llucy88Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
deightonConnect With a Mentor Commented:
  ' clear residue database left if this routine has gone wrong.
    If Dir(App.Path & "\temp.mdb") <> "" Then
        Kill App.Path & "\temp.mdb"
    End If

    ' compact databse to spare database
    DBEngine.CompactDatabase sDataBase, App.Path & "\temp.mdb"
   
    ' move status bar
    frmAutograph.lblCompleteProgress.width = (iIncrement + 1) * (nWidth) / iTotalIncrement
   
    FileCopy App.Path & "\temp.mdb", sDataBase

    Kill App.Path & "\temp.mdb"
0
All Courses

From novice to tech pro — start learning today.