Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

宣告參數查詢中所有參數的名稱和資料類型。

語法

PARAMETERS name datatype [, name datatype [, ...]]

PARAMETERS 宣告由下列各部分組成:

部分

描述

name

這是參數的名稱。 指派給 Parameter 物件的Name 屬性,用於識別參數集合中的此參數。 您可以在應用程式執行查詢時,使用 名稱 做為對話框中顯示的字串。 使用方括弧 ([ ]) 以括住包含空格或標點符號的文字。 例如,[最低價格] 和 [開始報告為哪一個月?] 是有效的 名稱 自變數。

datatype

其中一個主要 Microsoft Access SQL 資料類型或其同義字。


備註

針對您經常執行的查詢,您可以使用 PARAMETERS 宣告來建立參數查詢。 參數查詢有助於自動化變更查詢準則的程序。 使用參數查詢時,您的程式碼必須在每次執行查詢時提供參數。

PARAMETERS 宣告是選擇性的,但加入時其位置會在任何其他陳述式 (包括 SELECT) 前方。

如果宣告包含多個參數,請使用逗號加以隔開。 以下範例包含兩個參數:

PARAMETERS [Low price] Currency, [Beginning date] DateTime;

您可以在 WHERE 或 HAVING 子句中使用 name,而不是 datatype。 下列範例預計會提供兩個參數,然後將準則套用至「訂單」資料表中的記錄:

PARAMETERS [Low price] Currency, [Beginning date] DateTime;

SELECT OrderID, OrderAmount FROM Orders WHERE OrderAmount > [Low price] AND OrderDate >= [Beginning date];



Need more help?

Want more options?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。

社群可協助您詢問並回答問題、提供意見反應,以及聆聽來自具有豐富知識的專家意見。

Was this information helpful?

How satisfied are you with the translation quality?
What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×