RE: Can I Pass Query Parameters Through SQL Statements?

From: JohnJohn (JohnJohn_at_discussions.microsoft.com)
Date: 08/10/04


Date: Tue, 10 Aug 2004 07:57:04 -0700

Thanks for your reply!

Let me put this in concrete terms. Suppose I have a parameterized query
that looks like this:

SELECT MAX(RecordID) FROM MyTable WHERE CompanyID = [Which company number?];

How would I structure an SQL query to call this query passing the CompanyID
in the SQL string? For what it's worth, the query above will be used as a
subquery nested inside another query.

Thanks!
John

"Van T. Dinh" wrote:

> You can construct the SQL String (with parameters replaced
> by explicit values) in code and then use this String as
> the Source (for Recordset.Open ?)
>
> HTH
> Van T. Dinh
> MVP (Access)
>
>
>
> >-----Original Message-----
> >Hello,
> >
> >I have a parameter query, and really need to be able to
> pass the parameters
> >through an SQL statement rather than an ADO property, or
> anything similar to
> >that. I'm guessing that since my search thus far hasn't
> returned any results
> >indicating that this can be done, that it must not be
> possible.
> >
> >Does anyone know if this is possible?
> >
> >Thanks MUCH!
> >
> >John
> >.
> >
>



Relevant Pages

  • Re: DBMS and lisp, etc.
    ... Naively implemented with SQL, again for 10 ... (1 query for the initial orders, 1 query for each order for its ... soon as you upgrade to the SQL database. ... (eq (order-customer orderA) ...
    (comp.lang.lisp)
  • Re: Global variables are slowing down the query
    ... In the query design grid, typically in the Criteria row, you can refer to a ... Ideally you want to declare this as a parameter to the query, ... If you are comfortable with writing SQL, you could create the SQL string ...
    (comp.databases.ms-access)
  • Re: Populating a list -- table structure?
    ... I had made a report already and figured out about adding the ... your responce below, but thanks to your help with SQL, I was able to get the ... It takes a summary from a select query and gives the ... KitID, long integer ...
    (microsoft.public.access.forms)
  • How do I do Paging through a large dataset via Stored Procedures
    ... Paging by dynamically altering the SQL Query ... Create stored procedures ... SELECT * FROM STUDENTS ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Populating a list -- table structure?
    ... I don't mean to skip your responce below, but thanks to your help with SQL, I was able to get the query to pull the info the way I needed. ... I have one report complete, ... Queries (just shows the QBE grid for convenience -- ...
    (microsoft.public.access.forms)