DGWhittaker
asked on
Access 2016 - Query Challenge
Greetings!
I have a query that needs to pull certain data from a form, however it isn't behaving.
Please review this SQL code and let me know if you see where I went sideways,
thanks!
Dennis
SELECT DISTINCTROW tbl_entry_sheet.team_leade r, ([first_name] & " " & [last_name]) AS Sales, tbl_entry_sheet.deal_num, tbl_entry_sheet.total_est_ feg, Avg(tbl_entry_sheet.days_i n_stock) AS AvgOfdays_in_stock, Avg(tbl_entry_sheet.billed _beg) AS AvgOfbilled_beg, Avg(tbl_entry_sheet.ptoc) AS AvgOfptoc, 1 AS CountOfsalesman_id1, tbl_entry_sheet.deal_type, [total_est_feg]+[billed_be g]+[ptoc] AS Contribution, Count(tbl_entry_sheet.cust omer) AS CountOfcustomer, tbl_entry_sheet.dealdate, tbl_entry_sheet.dealdate, [billed_beg]+[ptoc] AS ["BEG+BS"], tbl_entry_sheet.deal_type, tbl_entry_sheet.tint_amt, tbl_entry_sheet.tint, GunnDealershipData.Logo
FROM tbl_new_vehicles, (tbl_entry_sheet INNER JOIN tbl_salesmen ON tbl_entry_sheet.salesman_i d1 = tbl_salesmen.salesman_id) INNER JOIN GunnDealershipData ON tbl_entry_sheet.store_id = GunnDealershipData.[Store# ]
GROUP BY tbl_entry_sheet.team_leade r, ([first_name] & " " & [last_name]), tbl_entry_sheet.deal_num, tbl_entry_sheet.total_est_ feg, [total_est_feg]+[billed_be g]+[ptoc], tbl_entry_sheet.dealdate, [billed_beg]+[ptoc], tbl_entry_sheet.deal_type, tbl_entry_sheet.tint_amt, tbl_entry_sheet.tint, tbl_entry_sheet.store_id, tbl_entry_sheet.deal_type, tbl_entry_sheet.dealdate, tbl_entry_sheet.dealdate
HAVING (((tbl_entry_sheet.store_i d)=[Forms] ![LaunchPa d]![Dealer ship]) AND ((tbl_entry_sheet.deal_typ e)>=[Forms ]![LaunchP ad]![Start Date]) AND ((tbl_entry_sheet.dealdate )<=[Forms] ![LaunchPa d]![End Date]));
I have a query that needs to pull certain data from a form, however it isn't behaving.
Please review this SQL code and let me know if you see where I went sideways,
thanks!
Dennis
SELECT DISTINCTROW tbl_entry_sheet.team_leade
FROM tbl_new_vehicles, (tbl_entry_sheet INNER JOIN tbl_salesmen ON tbl_entry_sheet.salesman_i
GROUP BY tbl_entry_sheet.team_leade
HAVING (((tbl_entry_sheet.store_i
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Why is my answer incorrect?
I think PatHartman posted the best answer
Without a response, no one knows, an no reply will be of interest or knowledge for upcoming readers. Thus a delete.
/gustav
/gustav
As I look at again, the second condition is most likely the issue.
((tbl_entry_sheet.deal_typ e)>=[Forms ]![LaunchP ad]![Start Date])
deal_type should probably be dealdate.
However, the use of HAVING is still incorrect. It is just not causing this problem.
((tbl_entry_sheet.deal_typ
deal_type should probably be dealdate.
However, the use of HAVING is still incorrect. It is just not causing this problem.
ASKER
Greetings All!
Sorry to have caused a concern.
In the end this was a nonsensical issue where I was calling the field name instead of the field. The original code worked fine.
I want to make sure everyone gets recognized for their efforts, so should I simply give everyone some credit?
Thanks!
Dennis
Sorry to have caused a concern.
In the end this was a nonsensical issue where I was calling the field name instead of the field. The original code worked fine.
I want to make sure everyone gets recognized for their efforts, so should I simply give everyone some credit?
Thanks!
Dennis
ASKER
I have closed this question at least 2 times already.
I don't know why it still pops up,
Thanks!
Dennis
I don't know why it still pops up,
Thanks!
Dennis
ASKER
When I run the query it comes up empty even though there is data in the form to filter the data by dealership, start and end date.
Hope that helps!
Thanks all!
Dennis