oConnString = "Driver={Microsoft Access Driver (*.mdb)};Dbq=N:\emPath.mdb"
Set oConn = New ADODB.Connection
Set rs = New ADODB.Recordset
Set oCmd = New ADODB.Command
oConn.Open oConnString
Year = InputBox("Year")
Set oCmd.ActiveConnection = oConn
oCmd.CommandText = "qryQueryName"
oCmd.CommandType = adCmdStoredProc
oCmd.Parameters.Append oCmd.CreateParameter("Year", adInteger, adParamInput)
oCmd.Parameters("Year") = Year
Set rs = oCmd.Execute
|