In SQL, views cannot accept parameters (unlike queries in MS Access). To accomplish what you are trying to do, you will need to create a stored procedure. For example, consider the following for the pubs database:
CREATE PROC spSalesForStore (
@iStore as int
)
AS
Code:
SELECT *
FROM sales
WHERE stor_id = @iStore
in your code (sample for VB), declare an ADOCommand object, set the .CommandText to the name of your stored procedure. Then:
Code:
oComm.Parameters.Refresh
oComm.Parameters("@iStore") = txtStoreID
Set oRS = oComm.Execute
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.