Now for a quick way to find glaring incompatibilities

advertisement
Converting Access Databases - 2.0 to 97
Access databases need to be converted from a lower to a higher version in order to be used by
the higher version. Thus in order to use an Access 2.0 database in Access 97, it must be
converted to Access 97 format. Once it has been converted, it can not be used by the earlier
version, nor can it be converted back. Microsoft has provided a conversion process that does a
pretty good job, especially if you have a fairly generic database without a lot of special features.
You will find that most of the objects (forms, reports, tables, queries, and macros) will be
converted with no problem. The exception is Access Basic code. The conversion process DOES
NOT TOUCH any code, which includes code behind the forms which was created with button,
combo box, list box, etc. wizards. In most cases, Access Basic (v2.0) and VBA (v97) are
compatible enough that no changes need to be made. There are, however, some caveats, which
are addressed later.
You don’t actually convert a database when you “convert” it. What you really do is create a new
copy of it in Access 97 format. Therefore you will have two databases, one in Access 2.0 format
and one in Access 97 format. This being the case, we suggest the following method for
converting your databases.
1) Open Access 97, then open the Access 2.0 MDB you want to convert.
2) Click on the "Convert Database" option to allow initial conversion.
3) You will see another box called “Convert Database Into”.
a) This is asking what you want to name the new (A97) database and where do you want to
store it.
b) By default, it will call the file “db1.mdb”. Change this to the same name as your original
file, then add the letter 8 to the end, i.e.:
i) If the file was: “Phonelist.mdb”, change it to: “Phonelist8.mdb”
(you don’t actually have to type the .mdb, the program will add it itself.)
ii) Why “8”? Only because Access 97 is also called Access 8.0. The purpose for this is
to name the files so that you can readily tell which file is which. You will need this for
later when you delete the old version.
c) By default, it will probably want to store it in your I: drive in the Data/Access directory. If
this is where the original file is, that’s fine, otherwise, find the directory where the original
(A2.0) file is and save it there.
d) Once you find the correct directory and name the file correctly, click Save.
4) It will now go through the conversion process. If all goes well, your program will just open.
However, you may get an error message that says: “There were compilation errors during the
conversion or enabling of this database”. If this happens, simply click OK and proceed to
steps 6, 7, 8. If the database just opens, proceed to step 9.
5) If you get any other errors at this stage, please contact the Help Desk for information or
referral to one of our Access Developers.
6) In the converted Access 97 MDB, open any module or code behind a form or report (in
design view).
7) Click on Debug on the menubar.
8) Click on Compile and Save All Modules (the compile will stop on grossly incorrect
statements which you can fix, then repeat the Compile and Save until it finishes without error
[see below]). If the menu item is grayed out, it is already compiled, and you don’t have to do
anything further.
9) You should thoroughly test your new database, making sure that all the functions in the
original work properly in the Access 97 version. Once you are ABSOLUTELY sure it is
correct, you can delete the Access 2.0 version and rename the Access 97 version, removing
the “8”. If you are less than absolutely sure, rename the Access 2.0 version, adding a “2” to
the end, and rename the Access 97 version by removing the “8”. If after a few weeks or
months with no problems, it is probably save to then delete the Access 2.0 version.
1
D:\106740173.doc
You aren't guaranteed error free execution or a perfect MDB at this point because the conversion
will not change everything required. Access 2.0 was much more forgiving about some things
(see Number 3 below). Also the button boundaries and spacing on forms (and spacing on
reports) may, at times, be slightly different (the font spacing may have been slightly different).
And, if you really care, the images on buttons are in some cases different sizes.
Simple coding errors you can correct:
1. One of the most common errors at compile time involves the “DoCmd” statement. In Access
2.0, it was used like this:
DoCmd Maximize
DoCmd DoMenuItem A_FORMBAR, A_EDITMENU, A_SELECTRECORD
DoCmd OpenTable “Orders”, A_NORMAL
these can be corrected by placing a dot (.) between DoCmd and the next word without any
spaces, so they would be:
DoCmd.Maximize
DoCmd.DoMenuItem A_FORMBAR, A_EDITMENU, A_SELECTRECORD
DoCmd.OpenTable “Orders”, A_NORMAL
These errors are common, because many of the wizards create code with DoCmd, and of
course, the Access 2.0 wizards created them the 2.0 way. So even if you don’t think you
have code to convert, if you used wizards to make buttons, combo boxes, list boxes, etc., you
do. Since the conversion process does not touch code, you will have to.
2. Access 97 will often issue an error message during execution (i.e. when you run your
program) if you have incorrectly mixed up the use of bang (!) and dot (.). The conversion will
not catch this. Access 2.0 generally allowed interchange of (!) and (.) where it was
interpretable.
3. Access 97 seems much more likely to cause an execution error when you use a reserved
word in an illegal manner (such as for a name of a control or table column--without brackets).
For instance, a common problem is to name a field “Date”. Since “date” is a reserved word,
this may cause a problem in a query if you don’t use square brackets [] around it when it is
used in the criteria. A better solution is to rename it EVERYWHERE as “StartDate” or
something else which is applicable. We can provide a reserved word list if you need one.
If you have errors which are not covered by the above, contact the Help Desk for additional
information.
2
D:\106740173.doc
Download