CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 1999
    Posts
    128

    Nested parameter queries in access 2000.

    Hi all

    I have an Access 2000 DB. In it i have a query Q1:
    Code:
    PARAMETERS DATE_FROM DateTime, DATE_TO DateTime;
    SELECT *
    FROM TABLE_1
    WHERE (TABLE_1.tb1_Date>=DATE_FROM) And (TABLE_1.tb1_Date<=DATE_TO);
    I would like to call Q1 from within Q2. How do i pass the DATE_FROM and DATE_TO parameters from Q2 to Q1? I tried to create a Q2 like this:

    Code:
    SELECT *
    FROM Q1
    WHERE (DATE_FROM=#1/1/2005#) And (DATE_TO=#12/31/2005#);
    but of course it didn't work.
    -------------------------
    Nick A.

  2. #2
    Join Date
    Nov 2004
    Location
    Poland
    Posts
    1,355

    Re: Nested parameter queries in access 2000.

    Did U try this:

    Code:
     
    PARAMETERS DATE_FROM DateTime, DATE_TO DateTime;
    SELECT *
    FROM Q1
    WHERE (DATE_FROM=#1/1/2005#) And (DATE_TO=#12/31/2005#);

  3. #3
    Join Date
    Dec 1999
    Posts
    128

    Re: Nested parameter queries in access 2000.

    Quote Originally Posted by Krzemo
    Did U try this:

    Code:
     
    PARAMETERS DATE_FROM DateTime, DATE_TO DateTime;
    SELECT *
    FROM Q1
    WHERE (DATE_FROM=#1/1/2005#) And (DATE_TO=#12/31/2005#);

    Um, it probably wouldn't help declaring DATE_FROM and DATE_TO as parameters in Q2. They are Q1's parameters, i just wanted to assign a value to them in Q2 and pass them to Q1 in order to execute the statement. I probably should have written the following (it still wouldn't work but it would be more clear what i wanted to do:

    Code:
    WHERE (Q1.DATE_FROM=#1/1/2005#) And (Q1.DATE_TO=#12/31/2005#);
    I haven't found how to do this yet, event though i searched everywhere i could think of. It probably can't be done... Anyway, i found another solution to the problem i had. Thanks for your answer.
    -------------------------
    Nick A.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured