Dim cmd As New ADODB.Command
Dim r As ADODB.Recordset
Dim P As ADODB.Parameter
Dim SQL As String
Set cmd.ActiveConnection = CurrentProject.Connection
SQL = "SELECT ID, 型号 FROM tab产品型号 WHERE (产品名ID = ?)"
cmd.CommandType = adCmdText
cmd.CommandText = SQL
Set P = cmd.CreateParameter("A", adNumeric, adParamInput)'这一行中参数具体要根据你参数的数据类型来写,这个示例是按数值型来写的
P.Value = 1 '在这一行给参数赋值
cmd.Parameters.Append P
Set r = cmd.Execute