Solved

workspace creation in access 2010

Posted on 2013-01-12
3
492 Views
Last Modified: 2013-01-12
Hi,
I put this in a form in access :

Workspace.CreateDatabase(ByVal Name As String, _
                   ByVal locale As String, _
                   ByVal options As Variant) As Database


Private Sub cmdDatabase_Click()
    DBEngine.Workspaces(0).CreateDatabase("Exercise.accdb", . . .)
End Sub


not working when i click on the button in the access form ..
may any help  :}
0
Comment
Question by:drtopserv
  • 2
3 Comments
 
LVL 39

Expert Comment

by:als315
Comment Utility
Try to use this code:
Private Sub cmdDatabase_Click()
    Dim dbs as DAO.Database
    Set dbs = DBEngine.Workspaces(0).CreateDatabase("Exercise.accdb", dbLangGeneral)
    dbs.close
End Sub

Open in new window

0
 

Author Comment

by:drtopserv
Comment Utility
Yea i know that through DAO i can create the db.
but i`m asking why through the code i paste above can`t able to run it ..
it is just to learning purpose.
0
 
LVL 39

Accepted Solution

by:
als315 earned 200 total points
Comment Utility
DBEngine.Workspaces(0).CreateDatabase("Exercise.accdb", . . .) should return value to object, so proper syntax is:
Set ObjectVariable = DBEngine.Workspaces(0).CreateDatabase("Exercise.accdb", . . .)
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now