다음을 통해 공유


DoCmd.OpenQuery Method (Access)

The OpenQuery method carries out the OpenQuery action in Visual Basic.

Syntax

.OpenQuery(QueryName, View, DataMode)

A variable that represents a DoCmd object.

Parameters

Name

Required/Optional

Data Type

Description

QueryName

필수

Variant

A string expression that's the valid name of a query in the current database. If you execute Visual Basic code containing the OpenQuery method in a library database, Microsoft Access looks for the query with this name first in the library database, then in the current database.

View

선택

AcView

A AcView constant that specifies the view in which the query will open. The default value is acViewNormal.

DataMode

선택

AcOpenDataMode

A AcOpenDataMode constant that specifies the data entry mode for the query. The default value is acEdit.

Remarks

You can use the OpenQuery method to open a select or crosstab query in Datasheet view, Design view, or Print Preview. This action runs an action query. You can also select a data entry mode for the query.

참고

This method is only available in the Microsoft Access database environment. See the OpenView or OpenStoredProcedure methods if using the Microsoft Access Project environment (.adp).

Link provided by:커뮤니티 구성원 아이콘 The UtterAccess community | About the Contributors

Example

The following example opens Sales Totals Query in Datasheet view and enables the user to view but not to edit or add records:

DoCmd.OpenQuery "Sales Totals Query", , acReadOnly

About the Contributors

UtterAccess(영문일 수 있음)는 Microsoft Access 위키 및 도움말 포럼입니다. 가입하려면 여기를 클릭하십시오(영문일 수 있음).

참고 항목

개념

DoCmd Object

DoCmd Object Members