hockey8837
Registered User.
- Local time
- Yesterday, 21:58
- Joined
- Sep 16, 2009
- Messages
- 106
I'm trying to build a query that will return or exclude data based on a combo box.
Basically, have two values I want to sort by: [TargetPlantingDate] and [OwnerResponse].
These two values will pull contact records to generate a mailing list. I have been trying to model off another form/query setup I have where the user could select a zip code to filter or leave blank to return all records. But I need this the other way around- where if the user selects "Yes" from [OwnerResponse] the query will EXCLUDE all "yes" (we want to contact people who haven't said 'yes'), and if they leave the field blank, it will return only those who have not responded (or possibly said no-not absolutely necessary right now, but would be ideal-we usually just leave blank and looking at what we have, I don't actually see any 'no's for any records, but we might in the future). Finally, having an 'All' option would be ideal, too.
I've built my Query where I have
[TargetPlantingDate]: Criteria = [Forms]![frmCDBGMailings]![cbodate]; Or = [Forms]![frmCDBGMailings]![cbodate]
[OwnerResponse]: Or = [Forms]![frmCDBGMailings]![cboOwner]
[AltResponse]: Criteria = Is Null; Or = Is Not Null
Right now, the way I have this set up above, it will return ALL records of the [TargetPlantingDate] selected when I leave "cboOwner" is left blank, and will return only those with "cboOwner" value "yes" when I select "yes" from the value list (which is the only option in the value list, currently).
So, how do I get it to return "blank" results to me when nothing is selected, or alternatively exclude "yes" results when "yes" is selected?
Basically, have two values I want to sort by: [TargetPlantingDate] and [OwnerResponse].
These two values will pull contact records to generate a mailing list. I have been trying to model off another form/query setup I have where the user could select a zip code to filter or leave blank to return all records. But I need this the other way around- where if the user selects "Yes" from [OwnerResponse] the query will EXCLUDE all "yes" (we want to contact people who haven't said 'yes'), and if they leave the field blank, it will return only those who have not responded (or possibly said no-not absolutely necessary right now, but would be ideal-we usually just leave blank and looking at what we have, I don't actually see any 'no's for any records, but we might in the future). Finally, having an 'All' option would be ideal, too.
I've built my Query where I have
[TargetPlantingDate]: Criteria = [Forms]![frmCDBGMailings]![cbodate]; Or = [Forms]![frmCDBGMailings]![cbodate]
[OwnerResponse]: Or = [Forms]![frmCDBGMailings]![cboOwner]
[AltResponse]: Criteria = Is Null; Or = Is Not Null
Right now, the way I have this set up above, it will return ALL records of the [TargetPlantingDate] selected when I leave "cboOwner" is left blank, and will return only those with "cboOwner" value "yes" when I select "yes" from the value list (which is the only option in the value list, currently).
So, how do I get it to return "blank" results to me when nothing is selected, or alternatively exclude "yes" results when "yes" is selected?