ODBC parameter query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a set of foreign tables to query through a third party ODBC driver.
Queries with no parameters work well and queries with parameters entered
directly into the criteria box in design view (eg "Smith")work also, but once
I try to query using a square bracket prompt (eg [Enter Name]) or use a query
by form approach (eg =Forms!Form1!txtName) the query returns no records.

For performance reasons, I want to avoid importing the data into native
tables which is the only workaround I can come up with.

The documentation from the author of the driver confirms that the "Where"
clause is supported.

Can someone explain what's going on here?
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

A lot depends on the version of Access you're using, the db you're
connecting to thru the ODBC driver, and the type of connection you're
using: DAO or ADO.

It sounds like you're using SQL pass-thru queries (aka SPT queries),
which is run by DAO. To set up a query that has parameters I use VBA to
create the SQL string then stuff that string into the QueryDef's SQL
property. E.g.:

CurrentDb.QueryDefs("myQuery").SQL = strSQL

Then use the query.

The VBA code should read controls on a criteria form to build the WHERE
clause.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQdsh2YechKqOuFEgEQIkCwCfVYqwSn1UlU8bul2ZFWImTWg+hyAAoL/3
h53buVErafBkHe9WQkTH0/b8
=7Zp5
-----END PGP SIGNATURE-----
 
Back
Top