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

Null Error in Report revised

Status
Not open for further replies.

MISCurls

MIS
Dec 4, 2006
8
US
This is a revision to the Parameters query Null Error Trouble Thread.

I changed the query and am summing the quantity in the report only. The result of the report is still returning an error when the query does not produce a value for the Brand Name field when looking between the two specified dates.

This is my query:
SELECT [T Contents].[Brand Name], [T Contents].[Generic Drug Name], [T Contents].Strength, [T Removed].Date, [T Removed].[Drug Used], [T Removed].Quantity
FROM [T Contents] INNER JOIN [T Removed] ON [T Contents].ID=[T Removed].[Drug Used]
GROUP BY [T Contents].[Brand Name], [T Contents].[Generic Drug Name], [T Contents].Strength, [T Removed].Date, [T Removed].[Drug Used], [T Removed].Quantity
HAVING ((([T Contents].[Brand Name])=Forms![F Drug Used within Dates]![Brand Name]) And (([T Removed].Date) Between Forms![F Drug Used within Dates]!StartDate And Forms![F Drug Used within Dates]!EndDate));

Any help would be appreciated! Thanks in advance.
 
Hiya,

I'm really not a SQL expert, but do you need the GROUP BY clause in the query - can't you use the report to group what is supplied to it?

I have a feeling that GROUP BY will pull empty rows as long as it finds a Brand name, Drug Name etc.

Sorry if I'm wrong here - just an undeducated 'hunch'.

ATB

Darrylle


Never argue with an idiot, he'll bring you down to his level - then beat you with experience.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top