Solved

Creating old file version of access by CDaoDatabase

Posted on 2003-11-17
11
232 Views
Last Modified: 2013-11-20
Hi,
I have a problem I can't solve.
I'm using the visual C++ to create an Access file by the following code:

CDaoDatabase  pTempAccessDb;      
AfxGetModuleState()->m_dwVersion = 0x0601;
pTempAccessDb->Create(m_DBFilePath);
CREATE TABLE ...

but when I try to open the file in my Access XP version, a dialog is opened to choose whether to convert the file or open it.

I guess the file was built in an old version of Access.
How can I solve this problem???
Thanks in Advance !!!!
0
Comment
Question by:kukiya
  • 5
  • 3
11 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
I think you will find your DB is in Access 2000 format.

The message
a dialog is opened to choose whether to convert the file or open it
Should only appear the first time you try to open the DB from Access itself.  

What problems are being caused if you select the 'open' option (or the convert option)?
0
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
Or even worse in Access 97 format (dbVersion30 as parameter default in you create call), the 0x0601 will allow the DAO to open Jet4 format.

Can't you create the (empty) database with AccessXP then use DAO or ADO code to populate it with tables and queries as you require?
0
 

Author Comment

by:kukiya
Comment Utility
The problem is that I re-create the file many times, so every time I open the access file,this dialog appears. It doesn't look good...
0
 

Author Comment

by:kukiya
Comment Utility
I must create the file by the code, and not with Access.

As for ADO , I'm not familiar with the method.
maybe using  ADO and not Dao will help...
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
Could you create an 'empty' DB with AccessXP and your app makes a copy of this to the functional DB when required?

I've never tried creating a DB itself from code.  I always have a preprepared one I copy as above.
0
 

Author Comment

by:kukiya
Comment Utility
I need to create the file via a dialoge in wich the user chooses the path and the file name...

Is ADO ca  help ??? How do I change the code to work with ADO???

Thanks
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 100 total points
Comment Utility
'I need to create the file via a dialoge in wich the user chooses the path and the file name...'

No problems if you are doing the copy of an existing DB.
Look at SHFileOperation and SHFILEOPSTRUCT in the help
FO_COPY
Copy the files specified in the pFrom member to the location specified in the pTo member


Major changes going from DAO to ADO.  However bear in mind DAO is not going to be developed further by Microsoft.
0
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
My comments would be a way to achieve the desired effect
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
paragon account problem 9 96
Host to IP 7 73
Generic progress indicator 6 109
matchUp  challenge 9 71
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

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

15 Experts available now in Live!

Get 1:1 Help Now