Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

control on a form as a criteria on views 1

Status
Not open for further replies.
Nov 21, 2003
2
PH
how do i create a view wherein the criteria will be coming from my form's textbox?
anyone?:)
thanx in advance
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top