Query Issue

psycoperl

Active Member
Joined
Oct 23, 2007
Messages
339
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
  3. Web
Hi all,
I am trying to update this query to allow me to Limit to a single month (i.e. August 2011) the tblActivityLog.ActivityDateTime contains a timestamp based on now() for each record.

any assistance you can provide would be apreciated.

Code:
SELECT tblUsers.OTEID, tblActivityLog.ActivityDateTime, 
     tblActivityCodes.ActivityCatergory, tblActivityCodes.ActivityDescription, 
      Count(tblActivityLog.TrackerID) AS CountOfTrackerID
FROM ((tblActivityCodes INNER JOIN tblActivityLog 
          ON tblActivityCodes.ActivityCode = tblActivityLog.ActivityCode) 
    INNER JOIN tblSource ON tblActivityLog.SourceCode = tblSource.SourceCode) 
    INNER JOIN tblUsers ON tblActivityLog.OTEID = tblUsers.OTEID
GROUP BY tblUsers.OTEID, tblActivityLog.ActivityDateTime, 
        tblActivityCodes.ActivityCatergory, 
        tblActivityCodes.ActivityDescription;
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Here's one way:
Code:
SELECT tblUsers.OTEID, tblActivityLog.ActivityDateTime, 
     tblActivityCodes.ActivityCatergory, tblActivityCodes.ActivityDescription, 
      Count(tblActivityLog.TrackerID) AS CountOfTrackerID
FROM ((tblActivityCodes INNER JOIN tblActivityLog 
          ON tblActivityCodes.ActivityCode = tblActivityLog.ActivityCode) 
    INNER JOIN tblSource ON tblActivityLog.SourceCode = tblSource.SourceCode) 
    INNER JOIN tblUsers ON tblActivityLog.OTEID = tblUsers.OTEID
[COLOR=red]WHERE FORMAT([tblActivityLog].[ActivityDateTime]."mmyy")="0811"[/COLOR]
GROUP BY tblUsers.OTEID, tblActivityLog.ActivityDateTime, 
        tblActivityCodes.ActivityCatergory, 
        tblActivityCodes.ActivityDescription;
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,713
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top