Creating old file version of access by CDaoDatabase

Posted on 2003-11-17
Last Modified: 2013-11-20
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;

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 !!!!
Question by:kukiya
  • 5
  • 3
LVL 44

Expert Comment

ID: 9763050
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)?
LVL 44

Expert Comment

ID: 9763065
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?

Author Comment

ID: 9763066
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...
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.


Author Comment

ID: 9763081
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...
LVL 44

Expert Comment

ID: 9763134
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.

Author Comment

ID: 9763229
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???

LVL 44

Accepted Solution

AndyAinscow earned 100 total points
ID: 9763253
'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
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.
LVL 44

Expert Comment

ID: 11849702
My comments would be a way to achieve the desired effect

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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
How do you programatically show and hide the Windows 10 On-Screen-Keyboard? 3 813
Hibernate methods 2 77
pre4 challenge 19 104
Making an alias 7 101
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…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

820 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