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!

How do I base a view on a control from a form?

Status
Not open for further replies.

DaveCZ

Programmer
Mar 31, 2006
1
GB
I recently upsized my access database and found out that my parameter queries were not upsized. How do I base a view on a control from a form? eg SELECT * FROM table WHERE field1 = Forms!frmTest!txtField
 
You can't do that with a view - you actually have to make them stored procedures.

Stored procedures can be written just like views, but then in the criteria form you can put @NameOfVariable instead of the Forms!frmTest!txtField.

Then you have to pass the appropriate variable into the stored procedure. Here is one way:

if running a form or report, make the stored procedure the data source for it. Then in the properties dialog box, in the parameters option, put @NameofVariable = Forms!frmTest!txtField


If you are not doing this, there are a couple of different ways to get the variable into the stored procedure and we will need to know what you are trying to accomplish before giving more info.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top