?
Solved

workspace creation in access 2010

Posted on 2013-01-12
3
Medium Priority
?
565 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

Expert Comment

by:als315
ID: 38770261
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
ID: 38771196
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 40

Accepted Solution

by:
als315 earned 600 total points
ID: 38771240
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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses
Course of the Month13 days, 21 hours left to enroll

800 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