View Full Version : Using field in view criteria


jason_nevin
08-21-2007, 11:48 PM
Good morning

I have a list box with a SQL server view as the data source. I want the dataset to be filtered to include only results with a particular foreign key which is stored in a field on my form.

I can do it in the behind module by programmatically specifying the row source but I'm presuming that there is a better way. In Access you would specify a field name in the criteria of a query, but how do I do it in an Access Project?

Thanks.

SQL_Hell
08-22-2007, 01:58 AM
Hi there,

You need to somehow parse this filter value from the form to the view as an input parameter, but unfortunately views do not support parameters.

So you can either set the row source in a module as you mentioned or use a stored procedure with an input parameter.

For simplicity I would set the row source in a module