Link to home
Start Free TrialLog in
Avatar of M M
M M

asked on

qry that pulls up counts and $ totals by certain interval per sales rep for quote & sale activity

I have attempted asking this before, but can't seem to put the pieces together.  I hope I'm, at least, learning to to better ask my question(s)!  So I am starting over.

I have tblSales & tblQuotes that I want to pull up activity data by Rep by entering 3 parameters:  WeekEndingDate (weeks end on Fridays), month and qtr.  I also would like to include reps with 0 sales and/or quotes for any given interval.

Please let me know what add'l info you need.  I'm nervous about uploading a my db, tried to create a dummy db, but not sure I've masked all sensitive info.

Thank you for your help and patience to date, and going forward!
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

It would be helpful if at the least you posted some screenshots of the table designs for those two tables.
Avatar of M M
M M

ASKER

Thank you.
User generated imageUser generated image
Some of the qrys in nav pane don't work completely.  What else can try to provide you?
Dummy data and an Excel mockup of what you expect of the report would be very helpful
Avatar of M M

ASKER

Hang on ... it will take me a "minute" to get that to you!
Avatar of M M

ASKER

Whew ... great suggestion about the excel mock-up thingie!  BTW, the rpt in my db doesn't have gridlines (on purpose).
I have 13 or 14 reps that do individual spreadsheets weekly ... with varying degrees of proficiency, some even less than my proficiency w Access (lol?).

What else do you need?  = )
EE-ROUGHexcelmockup_Weekly-Sales-Rep.xls
Avatar of M M

ASKER

Patrick, forgive me, am fairly new at this, is there something I need to get you?  More dummy data?
Avatar of M M

ASKER

Respectfully, is my db so rookie or so off the mark no one has offered any comments, suggestions or direction, but one expert?  I am new to this site with all of its nooks & crannies -- I read some place that I needed to "stay engaged" in qtn.  And I have.  I realize experts are busy and I may have UNintentionally tried the patience of some.  I apologize.  But ... if I need to provide more info to get constructive direction, let me know.
I have tblSales & tblQuotes that I want to pull up activity data by Rep by entering 3 parameters:  WeekEndingDate (weeks end on Fridays), month and qtr.
So i guess you want to produce some weekly/ monthly/ quarterly reports based on the sales per individual sales representative? is this based on the field: QDate in tblQuotes OR field: SDate in table: tblSales?
Avatar of M M

ASKER

All of the above!  My week ending dates would be/are the same (Fridays) for both Quotes and Sales.  I created a tblWeekNum per an Expert's suggestion, but still don't know how to fully implement it with QDates and SDates in one report.

In my rptWeeklySales (includes details), I based it on qrySalesByRepWeekly and placed a subrptQuotes<60d bc in the footer section.  I didn't know how/if I could connect the 2 tables (quotes & sales) even though the weekend ending dates are the same for both.  Functionally the rptWeeklySales works, albeit a little clunky, but if a rep has 0 sales for the week, none of his/her data shows up even though they had quote activity.

If a rep has 0 sales, his/her data doesn't show up in my qryTotalSalesWeekly either.
think you could have couple of questions here... but let's tackle them one by one.

If a rep has 0 sales, his/her data doesn't show up in my qryTotalSalesWeekly either.
ok, so this gonna to be solved so that even a rep has 0 sales, you want to show his/her name in your report?

can you post the SQL statement of query: qryTotalSalesWeekly ?
Avatar of M M

ASKER

SELECT tblSales.RepID, [tblRep]![FNameRep] & " " & [tblRep]![LNameRep] AS FullName, Sum(tblSales.SAmt) AS SumOfSAmt, [SDate]+(7-Weekday([SDate],7)) AS [Week Ending Date]
FROM tblRep INNER JOIN tblSales ON tblRep.RepID = tblSales.RepID
GROUP BY tblSales.RepID, [tblRep]![FNameRep] & " " & [tblRep]![LNameRep], [SDate]+(7-Weekday([SDate],7)), tblSales.LNameRep
HAVING ((([SDate]+(7-Weekday([SDate],7)))=[Enter Week Ending Date]));

Thank you!  =O )
Avatar of M M

ASKER

I do not know how to reference an earlier thread ... but look at Part 2 aggregate query ...
you may try this:

SELECT tblSales.RepID, [tblRep]![FNameRep] & " " & [tblRep]![LNameRep] AS FullName, Sum(tblSales.SAmt) AS SumOfSAmt, [SDate]+(7-Weekday([SDate],7)) AS [Week Ending Date]
FROM tblRep LEFT JOIN tblSales ON tblRep.RepID = tblSales.RepID
GROUP BY tblSales.RepID, [tblRep]![FNameRep] & " " & [tblRep]![LNameRep], [SDate]+(7-Weekday([SDate],7)), tblSales.LNameRep
HAVING ((([SDate]+(7-Weekday([SDate],7)))=[Enter Week Ending Date]));

will this solved your query issue?
Avatar of M M

ASKER

Hi Ryan!  Nope, that did not work.
for another quick try... you may test this as well:
SELECT tblSales.RepID, [tblRep]![FNameRep] & " " & [tblRep]![LNameRep] AS FullName, Sum(tblSales.SAmt) AS SumOfSAmt, [SDate]+(7-Weekday([SDate],7)) AS [Week Ending Date]
FROM tblRep LEFT JOIN (select * from tblSales where ([SDate]+(7-Weekday([SDate],7)))=[Enter Week Ending Date]) ON tblRep.RepID = tblSales.RepID
GROUP BY tblSales.RepID, [tblRep]![FNameRep] & " " & [tblRep]![LNameRep], [SDate]+(7-Weekday([SDate],7)), tblSales.LNameRep

Open in new window

Avatar of M M

ASKER

no I get: syntax error in JOIN operation
ooops, you can try this instead:

SELECT tblSales.RepID, [tblRep]![FNameRep] & " " & [tblRep]![LNameRep] AS FullName, Sum(tblSales.SAmt) AS SumOfSAmt, [SDate]+(7-Weekday([SDate],7)) AS [Week Ending Date]
FROM tblRep LEFT JOIN (select * from tblSales where ([SDate]+(7-Weekday([SDate],7)))=[Enter Week Ending Date]) as  tblSales ON tblRep.RepID = tblSales.RepID
GROUP BY tblSales.RepID, [tblRep]![FNameRep] & " " & [tblRep]![LNameRep], [SDate]+(7-Weekday([SDate],7)), tblSales.LNameRep

Open in new window

Avatar of M M

ASKER

omg, well I see the reps names/records (the ones with no sales); but nothing else, their rep IDs don't appear like the other reps' records with sales!  but we're getting closer!
I will have to study this to see how/what you did to make the difference!

Can I award you points right now, or will that 'close this thread, y/n?  You deserve so much more!
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of M M

ASKER

RYAN, that worked!!!!!  YOU ARE A GENIUS and an angel!  I will study to try and understand.  Thank you again!!!!!!
Coooool, glad that eventually it works = )