[AccessD] Autonumber when?

Kenneth Ismert kismert at gmail.com
Wed Apr 6 15:13:46 CDT 2011


>
> jwcolby
> ...
> The code needs to work whether going to an MDB or SQL BE.  The code works
> fine for an MDB BE but fails for a SQL BE.
> ...
>

John,

This is probably what you are trying to avoid, but I'll say it anyway:

You should write separate code to handle the MDB and SQL Server BEs.

First, the obvious: Jet and SQL Server are very different.
 * It is unlikely that this is the only variation you will have to account
for throughout your code
 * Variations in code make it harder to test
 * When you do want to use SQL Server-specific features, like stored
procedures, you will have to split the code anyway
 * I have a personal distaste of "On Error Resume Next" coding, which I use
only for object cleanup code where there is literally nothing to raise an
error to.

All told, the cost and effort to make a large existing code base generic
will likely exceed the cost of just splitting it neatly into libraries that
support each database type.

Plus, you get more modular, flexible, testable code.

Again, this is what you are trying to avoid, but I felt I should say it,
anyway.

-Ken



More information about the AccessD mailing list