Solved

workspace creation in access 2010

Posted on 2013-01-12
3
548 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 200 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 Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Union & Crosstab qrys 101! 6 59
Omit After Update event 5 19
What can I do to shrink my Access Frontend? 12 46
Access lists formating 8 18
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.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

730 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