DAtabase is not closing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gaus
    New Member
    • May 2015
    • 3

    DAtabase is not closing

    My Database is not closing after creating filed. Please advise
    Code:
    Set mydb = DBEngine.Workspaces(0).OpenDatabase("\172.22.30.41\Training-Data\Training\Gaus\Vertical Updates\Database21.mdb") 
    tb = mydb.TableDefs("Sheet1") enter code hereSet fd = tb.CreateField(Me.Date1.Text, dbLongBinary, 1000) 
    tb.Fields.Append fd 
    mydb.Close 
    Set mydb = Nothing 
    MsgBox " Date Created" 
    Exit Sub
    Last edited by Rabbit; May 8 '15, 05:00 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    #2
    This looks like Access VBA. Is it?

    I have never seen a database get closed. According to the MSDN website, setting the variable to nothing is the equivalent to closing it.

    Also, you may need to append the table with the changes to the database again.
    Code:
    mydb.TableDefs.Append td

    Comment

    Working...