ACCESS 中叫做querydef,采用DAO,详细步骤如下,可以参考msdn"query definition"
Creating a Querydef
Creating a querydef, whether you save it in the database or use it as a temporary object, requires specifying the SQL statement that defines the query and setting any needed properties of the querydef. If the querydef represents a parameterized query, you also need to create the parameters and their corresponding fields and later set their values.Tip   You can also set and get field values and parameter values (in a recordset) dynamically, without using a querydef. See the article DAO Recordset: Binding Records Dynamically.Creating a new MFCCDaoQueryDef object creates the underlying DAO querydef object.To create a querydef Construct aCDaoQueryDef object.
Call the querydef object'sCreate member function.
In the Create call, pass a user-defined name for the querydef and a string that contains the SQL statement on which the querydef is based. While you can define the SQL string for a recordset with AppWizard or ClassWizard, you must write the SQL string for a querydef yourself. (You usually use class CDaoQueryDef directly rather than deriving your own querydef classes from it.)Save the querydef object in the database by calling itsAppend member function, unless you want to work with a temporary (unsaved) querydef. (See Using a Temporary Querydef.)

解决方案 »

  1.   

    参见MSDN中的DAOTABLE和DAOVIEW示例。
      

  2.   

    只能用DAO建立吗?
    我不想用DAO
    ADO、COM 行不行?
      

  3.   

    ADO中查找可以用_RecordSet对象中的Find方法
    过滤用Filter属性
    排序用Sort属性你可以查看ADO的帮助,全中文的
      

  4.   

    petercong(peter) :
      看看什么是ACCESS查询再答我吧
      

  5.   

    PRB: Views Created Using ADOX Are Not Visible in Access 2000 
    ID: Q246213 
    --------------------------------------------------------------------------------
    The information in this article applies to:ActiveX Data Objects (ADO), versions 2.1, 2.1 SP1, 2.1 SP2, 2.5, 2.6--------------------------------------------------------------------------------
    SYMPTOMS
    When using Microsoft ActiveX Data Objects (Microsoft ADO Ext. 2.1 for DDL and Security) to Append a new query (View) to an Access 2000 database, the query icon does not appear among the database queries when you start Access 2000. However, if you iterate through the Views collection or the Tables collection, it is listed. CAUSE
    At this time, Microsoft Access 2000 does not expose the interface that makes these views visible or available outside of its form level. RESOLUTION
    The only way to have new queries or views visible at this time is to do the following: Use Access 2000 user interface to create the query. 
    -or 
    Use DAO to create the queries. 
    You can also type the view name directly into an SQL statement or a Form, Report, List Box, or Combo Box RecordSource. Microsoft Access then uses it, but the query may not operate correctly; see the More Information section for details. STATUS
    This behavior is by design. MORE INFORMATION
    Microsoft Jet database engine 4.0 has both a legacy mode, that is used by DAO and Microsoft Access 2000, and an ANSI standard SQL-92 mode, which is used by ADO. Microsoft Access 2000 hides ANSI mode queries from the user because differences may make the queries operate incorrectly when the Microsoft Jet database engine is running in legacy mode.Please check the Wild Card Characters and Access 2000 and Legacy Application Compatibility sections of the following Knowledge Base article for more details: For additional information, click the article number below to view the article in the Microsoft Knowledge Base: Q225048 INFO: Issues Migrating from DAO/Jet to ADO/Jet 
    Steps to Reproduce Behavior
    Start Visual Basic 6.0 and select Standard EXE project. Form1 is created by default. 
    Using the Project and References menu, make a reference to the following type libraries: 
    Microsoft ActiveX Data Objects 2.1 Library
    Microsoft ADO Ext. 2.1 for DDL and SecurityorMicrosoft ActiveX Data Objects 2.5 Library
    Microsoft ADO Ext. 2.5 for DDL and Security Add three command buttons (Command1, Command2, Command3) and the following code to the default form: Option ExplicitDim cat As ADOX.Catalog
    Dim i as IntegerPrivate Sub Command1_Click()
    Dim cmd As ADODB.Command
    Dim vw As ADOX.View
    Dim tbl As ADOX.Table  Set cmd = New ADODB.Command
      cmd.CommandType = adCmdText
      cmd.CommandText = "SELECT * FROM orders"
        
      cat.Views.Append "AllOrders", cmd
        
      Set vw = cat.Views.Item("AllOrders")
      Set cmd = vw.Command  Debug.Print vw.Name
      Debug.Print cmd.CommandText
        
      Set cmd = Nothing
            
    End SubPrivate Sub Command2_Click()
      Debug.Print "Views Collection:"
      For i = 0 To cat.Views.Count - 1
        Debug.Print cat.Views.Item(i).Name
      Next
      Debug.Print "======End Views collection======="
    End SubPrivate Sub Command3_Click()
      Debug.Print "Tables Collection:"
      For i = 0 To cat.Tables.Count - 1
        Debug.Print cat.Tables.Item(i).Name
      Next
      Debug.Print "======End Tables collection======="
    End SubPrivate Sub Form_Load()
      Command1.Caption = "Create / Append new View"
      Command2.Caption = "Display Views Collection"
      Command3.Caption = "Display Tables collection"
        
      Set cat = New ADOX.Catalog
      ' Change the connection string as appropriate
      cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=NWIND.MDB;"End SubPrivate Sub Form_Unload(Cancel As Integer)
      Set cat = Nothing
    End Sub 
    Change the connection path to point to Nwind.mdb on your computer. 
    Run the project. 
    If you click Create / Append new View, the immediate window displays the name of the view AllOrders followed by the query text Select * from Orders. 
    If you click on Display Views Collection or Display Tables collection buttons, the names of the views and/or the names of the Tables are shown and AllOrders is in both. 
    Use Access 2000 to open the Nwind.mdb file and click Queries then notice that the new view AllOrders is not listed. REFERENCES
    For more information, please refer to the following Knowledge base article: For additional information, click the article number below to view the article in the Microsoft Knowledge Base: Q225895 ACC2000: ADO Includes Queries and Views in the Tables Collection 
    © Microsoft Corporation 1999, All Rights Reserved.
    Contributions by Hussein Abuthuraya, Microsoft Corporation
    Additional query words: Keywords : kbJET kbGrpVBDB kbGrpMDAC kbDSupport kbMDAC250 kbMDAC260 
    Version : :2.1,2.1 SP1,2.1 SP2,2.5,2.6 
    Platform : 
    Issue type : kbprb 
    Technology : 
      

  6.   

    选择查询select,更新查询update,你是问这个吗?