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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter recordset by code 2

Status
Not open for further replies.

munger

Programmer
Feb 28, 2001
23
IL
I have a program for a professional winemaker. The wines change year by year and are identified with the "Vintage" year.

I really would like to code a filter for a recordset to show the only those records with the chosen vintage. I don't know how to code such a filter.

I could also use a parameter query that asks for the vintage year, but sometimes the user will want to change the vintage on the run and I don't know how to "request" that the query ask me once more for the parameter.

I tried to build a link from the criteria of the query to a text box on the form (txtVintage), but the program didn't respond to the "OnChange".

Any hints?

Thank you.
 
Hi!

You can build your parameter query and base your form on the query. When the form is opened the user will be asked to choose a vintage. On the form you can put a command button which says Choose Another Vintage. In the Click event put the command Me.Requery. The form's query will run again and the user will be asked to choose another vintage.

hth
Jeff Bridgham
 
normally when i do criteria things on a form I use a list box or a combo box, with the row source so for you it would be something like

SELECT DISTINTROW [tblwines].[Vintage] FROM [tblwines]

The on the on click property i do either one of two things either

Dim StrFilt as string

strfilt = "[Vinatge]=" & list1.value &""

me.filter = strfilt
me.filteron = true

(that migth be the otherway round)


Or put on the click property

me.refresh

then in teh query put the list1 value as the criteria





me


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top