Microsoft Access
  Home arrow Microsoft Access arrow Page 2 - wsh
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MICROSOFT ACCESS

wsh
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 17
    2006-02-15

    Table of Contents:
  • wsh
  • Creating a parametric query
  • Turning this into a Data Access Page
  • Page display in the browser

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    wsh - Creating a parametric query


    (Page 2 of 4 )

     What the parametric query accomplishes

    Let's begin by creating a parametric query. Let's also use the table shown above. What we want to accomplish is this: when the query is run, the program asks for the CustomerID we want to look up. When we supply the CustomerID as an input, the query returns all of the columns (or some chosen columns) for that particular row. For example, if you supply the CustomerID as 'ALFKI', you should retrieve all the information for this particular customer, such as Customer Name, Contact Name, Contact Title, etc.

    Designing the Select query

    There are many ways of designing the queries, as you can learn from reading other articles on this site. Click on the tab New when you have highlighted the Queries object. This opens the interface for creating the query, and offers a number of options for creating the new query.

    Choose Design View and click OK. This opens up the next window. If you choose Customers from the list of tables, the table related list is added to the design pane of the query designer as shown. After choosing the table (or tables, or queries and tables as the case may be), close the Show Table window.

    Now create a Select query by simply choosing the columns you want included in your selection. If you click on the drop-down arrow next to Field : it brings up a drop-down showing all the columns in the table.  You can choose the columns you want, in the order you want as shown. You can achieve the same result by just double clicking the column in the list on the design pane and the column is added to the list from left to right.  This query and its modifications are saved as Qparam.

    Turn a Select query into a Parametric query

    Once you have the Select query it is very simple to turn it into a parametric query. All you need to do is shown in the next picture. Since we want to search the records for the Customer of our choice, the CustomerID becomes the parameter, and it is the one that is used in the criteria for the search. Enter [CustomerID: ] exactly as shown. After each change to a query you will be asked to save the modification, and you should not forget this to incrementally modify your query.

    Row returned by the parametric query

    When you double click the Query, Qparam in this case, the program pops up a little form asking for your input as shown. The form also shows that it is asking for a particular parameter, CustomerID:

    For example, if you type in 'ALFKI' and click OK, the query returns all the selected column values in your select query as shown here.

    The SQL behind this Query

    Behind the scenes, the query runs an SQL command against the table. This can be reviewed by right clicking an empty area in the design pane and choosing the SQL View. This brings up the following window, which shows the SQL statement. You could make changes to this statement, but once you save this after modifying, you cannot access the design view.

    More Microsoft Access Articles
    More By Jayaram Krishnaswamy


       · One good way to get just what you want is parametric query. No need to get the whole...
       · HiSorry 'bout being anoni mouse, still waiting for the registration email to hit...
       · Try this work around, change your query from select to 'Make table' and base your...
       · Thanks, but I don't think that will work for me. I can base a DAP on the table, but...
       · The reason "like" does not work is because as much as this article wants you to...
       · Thanks for the comments. Since the query has no problem, the problem would be with...
       · I tried to use *Name* as my parameter in my DAP. I know that it should return...
       · DAPs run on the ADO model, so you probably need an ANSI wildcard in your LIKE...
       · The above poster is right. Dunno if anyone's come across it, but a more detailed...
       · The KB article is very clear. sincerely,Jay
       · I had similar problems described in the article above. Based on the discussion and...
       · I'm trying to implement a small variation of this tutorial. I have a simple access...
       · Since you are trying to use the relationships between two queries, it will be better...
       · HiI've read your articels and looked at your website.And found out that you...
       · Are the three tables connected in any way? You can drop controls on the Data Access...
       · sorry about posting as 'any mouse', but my account password hasn't arrived yet. ...
       · I worked as an experimentalist in the hard sciences most of my life. There is...
       · I have dependant drop down lists in a form in Access 2000... i have one simple table...
     

    MICROSOFT ACCESS ARTICLES

    - Linking SQL Express 2005 Tables to MS Access...
    - Working with Access Projects in Access 2007
    - Exploring Access 2007
    - Working with Stored Procedures in an MS Acce...
    - Creating and Using Action Queries
    - Creating Data Access Pages with Charts using...
    - Advanced Ideas using VBA
    - VBA Details
    - Updating Records in MS Access
    - Using ADO`s Record Object with URLs
    - Exporting XML from MS Access 2003
    - Importing XML into MS Access 2003
    - On Using Pass-through Queries in MS Access
    - Distributed Queries in MS Access
    - Configuring a Linked Microsoft Access Server...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT