''------------------------------------------------------------
' 処理内容:パラメータクエリーに引数をセットして実行
' 引数:
' 戻り値:なし
'------------------------------------------------------------
Private Sub RunParamQry()
Dim strsql As String
Dim myDb As Database
Dim myQdef As QueryDef
Dim strFormName As String
On Error GoTo Err_Exit
'警告OFF
DoCmd.SetWarnings False
Set myDb = CurrentDb
'引数に定義済みのクエリーの名前を指定
Set myQdef = myDb.QueryDefs("Qryname")
With myQdef
'パラメータ(ID)に値をセット
.Parameters("ID") = 123
'アクションクエリーを実行
.Execute
End With
'クエリー定義の開放
Set myQdef = Nothing: Close
'警告ON
DoCmd.SetWarnings True
End Sub
コメント