You can create a query based on a campaign, but not based on a donation form. If you have not yet created the form, put it in a campaign by itself. If you have already created the form, and it is in a campaign with other forms, you will not be able to query on historical data. However, you can redirect the old donation form to a new donation form that is in a campaign by itself. This will let you report on donations going forward. See: How do I redirect my unpublished donation form?