Hello
I have a form that has a search button. Search button calls on a query.
SELECT Info.InfoEntryID, Info.InfoDate, Info.InfoBarrelNum, Info.InfoPh, Info.InfoSalinity, Info.InfoAcid, Info.InfoDip, Info.InfoText, Info.InfoMRU, Info.InfoBarrelID
FROM Info
WHERE (((Info.InfoDate)>=[Forms]![frmInfoBatchEntry]![DateFrom] And (Info.InfoDate)<=[Forms]![frmInfoBatchEntry]![DateTo])
AND ((Info.InfoPh)>=[Forms]![frmInfoBatchEntry]![phLow]
And (Info.InfoPh)<=[Forms]![frmInfoBatchEntry]![phHigh])
AND ((Info.InfoSalinity)>=[Forms]![frmInfoBatchEntry]![SaltLow]
And (Info.InfoSalinity)<=[Forms]![frmInfoBatchEntry]![SaltHigh])
AND ((Info.InfoAcid)>=[Forms]![frmInfoBatchEntry]![AcidLow]
And (Info.InfoAcid)<=[Forms]![frmInfoBatchEntry]![AcidHigh])
AND ((Info.InfoDip)>=[Forms]![frmInfoBatchEntry]![DipLow]
And (Info.InfoDip)<=[Forms]![frmInfoBatchEntry]![DipHigh]));
the issue is that for some date ranges there are multiple identical barrel numbers such as:
Range 1/1/2010 - 2/1/2010
Date Barrel Acid
1/1/2010 5 6
1/2/2010 5 7
1/1/2010 6 8
5/1/2010 7 1
Should be 3 records, first record is gun because it is not the latest input for that barrel.
Date Barrel Acid
1/2/2010 5 7
1/1/2010 6 8
5/1/2010 7 1
. For any given date range (((Info.InfoDate)>=[Forms]![frmInfoBatchEntry]![DateFrom] And (Info.InfoDate)<=[Forms]![frmInfoBatchEntry]![DateTo])
if there are multiple barrels select the barrel with the latest date. So it is date range with maximum date if there are multiple identical barrels.
Any ideas or examples would be greatly appreciated.
Thank you
I have a form that has a search button. Search button calls on a query.
SELECT Info.InfoEntryID, Info.InfoDate, Info.InfoBarrelNum, Info.InfoPh, Info.InfoSalinity, Info.InfoAcid, Info.InfoDip, Info.InfoText, Info.InfoMRU, Info.InfoBarrelID
FROM Info
WHERE (((Info.InfoDate)>=[Forms]![frmInfoBatchEntry]![DateFrom] And (Info.InfoDate)<=[Forms]![frmInfoBatchEntry]![DateTo])
AND ((Info.InfoPh)>=[Forms]![frmInfoBatchEntry]![phLow]
And (Info.InfoPh)<=[Forms]![frmInfoBatchEntry]![phHigh])
AND ((Info.InfoSalinity)>=[Forms]![frmInfoBatchEntry]![SaltLow]
And (Info.InfoSalinity)<=[Forms]![frmInfoBatchEntry]![SaltHigh])
AND ((Info.InfoAcid)>=[Forms]![frmInfoBatchEntry]![AcidLow]
And (Info.InfoAcid)<=[Forms]![frmInfoBatchEntry]![AcidHigh])
AND ((Info.InfoDip)>=[Forms]![frmInfoBatchEntry]![DipLow]
And (Info.InfoDip)<=[Forms]![frmInfoBatchEntry]![DipHigh]));
the issue is that for some date ranges there are multiple identical barrel numbers such as:
Range 1/1/2010 - 2/1/2010
Date Barrel Acid
1/1/2010 5 6
1/2/2010 5 7
1/1/2010 6 8
5/1/2010 7 1
Should be 3 records, first record is gun because it is not the latest input for that barrel.
Date Barrel Acid
1/2/2010 5 7
1/1/2010 6 8
5/1/2010 7 1
. For any given date range (((Info.InfoDate)>=[Forms]![frmInfoBatchEntry]![DateFrom] And (Info.InfoDate)<=[Forms]![frmInfoBatchEntry]![DateTo])
if there are multiple barrels select the barrel with the latest date. So it is date range with maximum date if there are multiple identical barrels.
Any ideas or examples would be greatly appreciated.
Thank you