Friday, March 9, 2012

Parameters in a VIEW

How do you go about creating a parameter in a view? In Access SQL, I know it is done like this:

parameter @.monthSelect as int;
SELECT tbl_xlat_beg.HCNumber, tbl_xlat_beg.LocationID, tbl_xlat_beg.BegValue, tbl_xlat_beg.Unit, tblbeg.use_id,
tbl_xlat_beg.Month_id
FROM tbl_xlat_beg
WHERE (((tbl_xlat_beg.Month) = [@.monthSelect]))

where monthSelect is requested. I'm trying to set up a group of queries to gather info but am not sure how to do this or for that matter test this in SQL. Any ideas would be great.Views cannot directly accept parameters. You may be able to achieve the same functionality with a user-defined function or a stored procedure, both of which are also more efficient than views.

blindman|||That's what the predicate is for...

I know in Access you can reference a control that doesn't exists

SELECT * FROM myTable WHERE myDate = [Please Enter a Date]

And you get a dialog...

You could just as easily have a control on a form the predicate references..

No comments:

Post a Comment