Sage 100: How to Create a SQL Specific Pass-Through Query
Create a SQL Specific Pass-Through Query in Access for Sage 100 and your Crystal Reports run noticeably faster than over linked tables — with auto-logon and no silent DSN.
Verification note (unconfirmed): This page's claims could not be re-verified against its primary Sage Community Hub thread in the latest verification pass (the source fetch was blocked / rate-limited). Treat specific file names, command lines, version scopes and steps below as unconfirmed until they are checked against the source thread and Sage KB for your version.
If your Crystal Reports crawl when they read Sage 100 data through linked Access tables, a SQL Specific Pass-Through Query is the established fix. Instead of Access negotiating with the ODBC driver row by row, the pass-through query hands the SQL directly to the ProvideX driver, and the data comes back fast — one measured comparison in the Sage community cut a report's load time from 14 seconds to 7, and heavier reports gain far more. As a bonus, the query carries its own logon, so nobody gets prompted for a company code and password, and you never have to build a silent DSN.
This procedure applies to Sage 100 Standard and Advanced (ProvideX data). Sage 100 Premium stores its data in SQL Server — query it natively there; this Access technique is not the Premium route.
The fix
You build one pass-through query per Sage table. Do not try to join tables inside a single pass-through query — layering, explained below, is how multi-table reports are built.
- Get clean SQL from Crystal first. Start a new Crystal report against the one Sage 100 table you need and add the fields you want. Open Database, Show SQL Query, and copy the entire SQL statement Crystal generated. This guarantees the statement uses table and field names ProvideX accepts.
- Create the Access database. Open Microsoft Access, create a blank database, and save it where the report users can reach it.
- Create the query as SQL-Specific, Pass-Through. Add a new query, close the table picker without selecting anything, then set the query type to Pass-Through (SQL-Specific). Paste in the SQL statement you copied from Crystal.
-
Type the connect string by hand. Open the query's Properties sheet and enter the ODBC connect string manually — the Access connection wizard does not work reliably with the MAS 4.0 ODBC driver, so do not use it. The documented format is:
ODBC;DSN=SOTAMAS90;UID=XXX|ABC;PWD=XYZ;Directory=<path to your MAS90 folder>;SERVER=NotTheServerReplace XXX with the Sage user ID, ABC with the company code — note the pipe character
|between the user ID and the company code — XYZ with that user's password, and the Directory with your own installation's path to the MAS90 folder. - Strip two options out of the string. Make sure
DirtyReads=1andBurstMode=1do not appear anywhere in the connect string. The original procedure flags this as critical — leaving them in breaks the query's behaviour. - Save and run the query. It should return data with no logon prompt. That is your working pass-through query for that table.
- Repeat for each table you need — one pass-through query per table, each with its own pasted SQL and the same connect string.
- Combine tables one layer up. Create an ordinary Access select query (or a make-table query, for very large data) that uses your pass-through queries as its sources, joins them there, and adds any running totals or calculations. Base the Crystal report on that top query — or add the report to the Sage 100 Custom Reports menu, in which case put "Converted to version 5.00" in the report's Summary Info so Sage does not try to convert it the first time it runs.
Options and approaches
Pass-through query vs. linked tables
Linked tables are easier to build and easier to break a report's performance with. Every filter and join is negotiated through Access and the driver, and on large history tables that is where the hours go. Pass-through queries cost more effort up front — every field you need must be in the pasted SQL — and pay it back on every run. For a report someone runs daily, the pass-through route is the right default.
Pass-through connect string vs. silent DSN
The other auto-logon route is a separate silent ODBC DSN. Sage's own guidance is that the existing SOTAMAS90 DSN is reserved for Sage 100 and must not be converted into a silent connection — doing so breaks once Sage itself starts on that workstation — so a silent connection means creating and maintaining an additional DSN on every workstation. The connect string in the query travels with the Access database instead, which is why this method has been the community standard since the MAS 90 4.x era.
What doesn't work
- Unsupported SQL inside the pass-through query. The query runs in ProvideX's SQL dialect, not full Access/SQL Server syntax. Constructs ProvideX does not support fail with "ODBC --call failed" and "[ProvideX][ODBC Driver] Expected lexical element not found: FROM (#1015)". Keep pass-through queries to one table and supported syntax, and do the clever work in the layered query on top. And check your own typing first — one reported case of exactly this error was a typo in the query, not a dialect problem.
- Letting Access save the password for you. When Access offers to save the password in the connection string it can complain the string is too long and refuse. Enter the connect string manually in the query Properties, as in step 4.
- Building the connection with the wizard. The ODBC wizard in Access does not work reliably with this driver — another reason the string is typed by hand.
Affected versions
Documented for MAS 90 / MAS 200 version 4.x with the MAS 90 4.0 ODBC driver, and reported in continuous use from MAS 3.21b through MAS 4.50 with Access 2007, on Sage 100 Standard and Advanced (ProvideX). Not a Sage 100 Premium procedure — Premium data is in SQL Server.
Prevention / best practice
- Use a dedicated Sage user ID for reporting queries, with a password that does not expire into someone's month-end, and document which reports depend on it — the credentials live inside every query's connect string.
- Keep a text copy of each query's SQL and connect string outside the Access database, so a damaged database does not take your only copy with it.
- Filter hard inside the pass-through SQL. The speed comes from the server side doing the work; pulling whole history tables and filtering in Access gives the speed back.
Related help
- Install ODBC Driver Without Workstation Setup
- ProvideX ODBC Driver Internal Error
- Sage ODBC with Sage 100 v2020
- Display Dynamic Image in Crystal Reports
- Unspecified Error Custom Crystal Report
Still stuck? Send us a screenshot of the error, we will diagnose it for free.
Digit Masters has supported Sage 100 and Sage 300 since 1997. Send the screenshot through our contact page or to contact@digitmasters.com, or call (800) 965-4262.