By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,530 Members | 891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,530 IT Pros & Developers. It's quick & easy.

DAtabase is not closing

P: 3
My Database is not closing after creating filed. Please advise
Expand|Select|Wrap|Line Numbers
  1. Set mydb = DBEngine.Workspaces(0).OpenDatabase("\172.22.30.41\Training-Data\Training\Gaus\Vertical Updates\Database21.mdb") 
  2. tb = mydb.TableDefs("Sheet1") enter code hereSet fd = tb.CreateField(Me.Date1.Text, dbLongBinary, 1000) 
  3. tb.Fields.Append fd 
  4. mydb.Close 
  5. Set mydb = Nothing 
  6. MsgBox " Date Created" 
  7. Exit Sub
May 8 '15 #1
Share this Question
Share on Google+
1 Reply


Seth Schrock
Expert 2.5K+
P: 2,939
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.
Expand|Select|Wrap|Line Numbers
  1. mydb.TableDefs.Append td
May 8 '15 #2

Post your reply

Sign in to post your reply or Sign up for a free account.