If I transfer data from a Access MDB into a SQL Server, will DAO code in a VB app work against the SQL Server.
I realise there will need to be changes to the initial connection calls but will anything else need to change?
If I transfer data from a Access MDB into a SQL Server, will DAO code in a VB app work against the SQL Server.
I realise there will need to be changes to the initial connection calls but will anything else need to change?
Directly no. But you can replace current access tables with linked tables to sql server.
Update: How to create a DSN-less connection to SQL Server for linked tables in Access
Not sure if this applies to your scenario, but the SQL syntax in Access (at least the older versions) have slightly different syntax from SQL Server e.g the wildcard characters for LIKE in the old, old versions of Access use * instead of the % used by SQL Server.
If you use SQL queries in your VB app, you might need to ensure that all SQL statements are SQL Server syntax-compliant.
I mentioned this mainly because you mentioned DAO and VB (I'm assuming VB 5/6 rather than VB.NET) which are rather old technologies and the Access MDB might be in a similiarly old format.
It all depends on how you are exchanging with the database:
A number of issues here.
if you're using an ADP for your front end to SQL Server, you won't be using DAO, as you can't, since ADPs don't use Jet/ACE. You'll then have a direct ADO connection to the SQL Server.
However, for the last 5 years or so MS has been deprecating ADPs in favor of MDBs/ACCDBs using ODBC (except for some reporting scenarios). There have been no changes to ADPs in A2007 and A2010, which may indicate that MS is planning to abandon them entirely (as they did with DAPs after no changes in A2002 and A2003). But it may also be that MS is planning to revive ADPs in the next version of Access, since the Access team has been actively seeking input from those using SQL Server.
Going with the recommended technology (MDB/ACCDB) with ODBC (and, presumably, linked tables), you're using Jet/ACE, and the logical data interface is DAO, Jet/ACE's native data interface.
Jet/ACE is actually pretty darned smart in dealing with a server database, but it does make mistakes, and there are certain types of queries that inexperienced Access developers might write that will be performance pigs with a server database (because they force Jet/ACE to pull the whole table from the server and do all the work on the client workstation -- see @Philippe Grondier's answer above).
The usual approach to working with SQL Server via ODBC from an MDB/ACCDB is to try it the Access way, with bound forms and the whole nine yards (nothing different than if you were designing your app for use with a Jet/ACE back end), and then use SQL Profiler to determine what parts are performance bottlenecks and should be restructured so that appropriate processing takes place server-side.
Judicious use of ADO is often warranted because there are certain things that ADO does brilliantly that DAO does poorly or not at all.
But the basic idea is to use the same approach as you would with a Jet/ACE back end because Jet/ACE is managing your interface with the server. This means you don't have to worry about the differences between Jet/ACE's SQL dialect and your server database's dialect, because Jet/ACE and ODBC abstract those differences entirely away.
A few random issues:
for DAO recordsets, you need to add the dbSeeChanges option.
it's crucial that all your tables have a primary key, or you may have weird screen updates. But all of you tables have PKs, right?
I find it advisable to put a timestamp field in all tables on SQL Server, even if I never use it explicitly. This (in combination with #2) insures that refreshes are as efficient as possible (ODBC can check the timestamp instead of needing to compare all the client-side fields one by one to the server-side values).
if you use passthrough queries or ODBCDirect, you'll need to worry about your server database's SQL dialect and keep straight which SQL is being handled by Jet/ACE (and interpreted for you into the back-end dialect) and which is going directly to the server.
Jet/ACE has no data type corresponding to bigint so if you use that as PK in a SQL Server table, you'll need to handle it in a non-standard way. The MS Knowledge Base has articles on working around this problem.
if you use ADO, remember that ADO uses what Access calls "SQL 92 compatibility mode," which means SQL Server wildcards and derived table syntax.