Re: ODBC parameter query

From: MGFoster (me_at_privacy.com)
Date: 01/04/05


Date: Tue, 04 Jan 2005 23:08:03 GMT


-----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-----
John Robinson wrote:
> 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?


Relevant Pages

  • Re: Access bombing out when importing through ODBC from AS/400 Databas
    ... I used queries all the time. ... So I would have to say there is something wrong with your query. ... At least in terms of how the ODBC driver modifies it and sends it to the ... > linked tables to open it up, it opens FINE. ...
    (microsoft.public.access.externaldata)
  • VB6-ADO-COM-ODBC-INFORMIX : Queries produce SQL State 37000.
    ... Connecting to a Informix 7.3 Database located on a Unix Server. ... Above query produces this error.... ... Microsoft OLE DB Provider for ODBC Drivers. ... ODBC Driver details are below.... ...
    (microsoft.public.data.odbc)
  • VB6-ADO-COM-ODBC-INFORMIX : Problem running query. SQL State 37000
    ... Connecting to a Informix 7.3 Database located on a Unix Server. ... Above query produces this error.... ... Microsoft OLE DB Provider for ODBC Drivers. ... ODBC Driver details are below.... ...
    (microsoft.public.data.ado)
  • VB6-ADO-COM-ODBC-INFORMIX-OLEDB - SELECT Query Err. SQLState 37000
    ... Connecting to a Informix 7.3 Database located on a Unix Server. ... Above query produces this error.... ... Microsoft OLE DB Provider for ODBC Drivers. ... ODBC Driver details are below.... ...
    (microsoft.public.data.oledb)
  • RE: Dynamically referencing a recordset?
    ... through that recordset to set the query parameters in VBA. ... to be the one who had to modify 1440 queries if there is a change in the ... different table schema, then you need 3, one for each record type. ... This is a database that tracks the production on records in another ...
    (microsoft.public.access.modulesdaovba)