The issue here is that the QODBC Optimizer is local to your computer only, so when other users change things in QuickBooks how does QODBC know? Well, by default the optimizer will update new and changed entries in a table from QuickBooks first and then execute the query against the local optimized table. This is faster than reading everything out of QuickBooks every time, especially the more data you have.
When you use either OPTIMIZE , OPTIMIZED or NOSYNC you by-pass the update process and the data read could be old. Resyncing updates the optimized table to match the data in QuickBooks. On the whole things work well, but the timestamps in QuickBooks are not changed by every change in QuickBooks, so when you're dealing with recent data that's changing all the time, you should use the CALLDIRECT or UNOPTIMIZED tag.
For example, to read new InvoiceLines directly out of QuickBooks use:
select * from InvoiceLine UNOPTIMIZED WHERE Txndate > {d '2006-04-01'}
Or you can resync your optimized InvoiceLine table by first doing:
sp_optimizefullsync InvoiceLine
then read directly out of the optimized table by doing:
select * from InvoiceLine NOSYNC
This is very f...a.......s.................t.
Another good example of using NOSYNC would be to get for example all invoicelines before 2003:
SELECT * from InvoiceLine NOSYNC WHERE Txndate < {d '2004-01-01'}
as invocies before 2004 don't ever change, you can read them directly from the QODBC Optimizer. You just need to use unoptimized for crtical operations like Sales Commisions etc.
See: How do I setup the QODBC Optimizer? Where are the Optimizer options? for more information.
See also: How do I create a Pass-Through Report using Microsoft Access 2003? |