Query by form

C

Craig

I am using a subform which is based on query which summarizes donations made
donor for that year. The query groups all donations by year.

In the subform, I would like to add a button at the end of each row that
will bring up another form which displays all donations for that year.

How do I link a button using the "year" field in the subform that will use
the year in another query that will then display the all records for that
year only in another form.

Craig
 
J

Jezzepi

If I understand you, It sounds as though you are using a multiform list in
your subform and you wish to place a button on each list item.

First, it isn't necessary to place a button on each list item. One button
on the parent form or in the subform's form footer will do. However, if you
just want it that way, it's no proplem either.

What ever the case your button will do the following:
1. get the key data that relates the current data to the data you will
display in the form to be opened.

2. You will then use the DoCmd.OpenForm to open the new form using the Where
expression to set the new form's current record to the desired data key.

If you do this from the subform the code will look like this:

if(not IsNull(Me.MyField)) then
MyVar = Me.MyField
docmd.openform "MyNewForm",,,"MyField = " & MyVar
end if

If you do this from the parent form then you will have to modify the
form reference "Me" to Me.MySubForm.Form!MyField.

Hope this helps!

Best

J.
 
C

Craig

Can this be done using Two conditions. I want to look up by member and by
year

eg. Where the MemberID=MyVar and Year=MyVar2
Craig
 
Top