Go Back   Access World Forums > Microsoft Access Discussion > Macros

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 10-28-2019, 11:02 AM   #1
Kstruth
Newly Registered User
 
Join Date: Oct 2019
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Kstruth is on a distinguished road
Exclamation Program Macro to Return Results Based on Checkbox

I have a SharePoint list attached to Access to that feeds all fields in a beautiful Access report.

Currently, a macro currently in the form created prior to my arrival. One complete report with all personnel's reports and one specifically for each personnel to view their own reports to check for accuracy.

Each individual should be able to hit the programmed button and see their reports only and if the reports are "Ready for Meeting" (checkbox is checked). This way they can preview in Print Preview to ensure all data transferred/etc.

The macro is not working correctly (I do not write macros) and is currently returning results for each individual, however it includes all of their reports instead of just ones marked "Ready for Meeting"

Kstruth is offline   Reply With Quote
Old 10-28-2019, 11:26 AM   #2
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 6,445
Thanks: 58
Thanked 1,412 Times in 1,393 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Program Macro to Return Results Based on Checkbox

Hi. Can you post the code behind the macro?
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Old 10-28-2019, 11:40 AM   #3
Kstruth
Newly Registered User
 
Join Date: Oct 2019
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Kstruth is on a distinguished road
Re: Program Macro to Return Results Based on Checkbox

Hi there - so a bit simplistic - no code.

Report Selection: Command12 On Click

OpenReport

Report Name:
View:Print Preview
Filter Name:
Where Condition:
Window Mode:Normal

Otherwise not sure how to see the code. It is not Visual Basic as of now. it looks like a wizard action.

Kstruth is offline   Reply With Quote
Old 10-28-2019, 11:47 AM   #4
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 6,445
Thanks: 58
Thanked 1,412 Times in 1,393 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Program Macro to Return Results Based on Checkbox

That's good enough for now. It looks like the WhereCondition is empty, that's why you're seeing all the records. To filter the report to a specific user, you'll need to add a Criteria in the WhereCondition. It might look something like this:
Code:
"UserID=" & [UserID]
That example will probably not work by itself. We may have to see more about your form or report to give you the exact syntax.
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Old 10-28-2019, 11:52 AM   #5
Kstruth
Newly Registered User
 
Join Date: Oct 2019
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Kstruth is on a distinguished road
Re: Program Macro to Return Results Based on Checkbox

OK. So the button in particular is returning the correct user, however the one parameter I don't know how to program is only show if "Ready for Meeting" field is checked YES. What is the syntax for that?

I should add the user name is coming from an unbound list of personnel the user selects before hitting the "View by Personnel" button.
Kstruth is offline   Reply With Quote
Old 10-28-2019, 11:54 AM   #6
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 6,445
Thanks: 58
Thanked 1,412 Times in 1,393 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Program Macro to Return Results Based on Checkbox

Maybe, what we need to change is the query you're using for the report. Can you post the SQL statement of the query? Thanks.
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Old 11-15-2019, 11:46 AM   #7
Kstruth
Newly Registered User
 
Join Date: Oct 2019
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Kstruth is on a distinguished road
Re: Program Macro to Return Results Based on Checkbox

SELECT [PjM Presentation Order].[Presentation Order], [eQuad - PMR Ready].[PMR Ready?], [eQuad - PMR Ready].[TO Status], [PjM Presentation Order].[PjM FirstName LastName], [eQuad - PMR Ready].Notes, [eQuad - PMR Ready].[Is this to be briefed at next PMR?] AS Expr1, *
FROM (SELECT DISTINCTROW eQuad.*, [eQuad Image Library].[Embedded PowerPoint], eQuad.[Mark for Archive] FROM eQuad LEFT JOIN [eQuad Image Library] ON eQuad.[CRQ #] = [eQuad Image Library].[CRQ #] WHERE (((eQuad.[Mark for Archive])=No)) ORDER BY eQuad.[Presentation Order], eQuad.[Slide Order]) AS [eQuad - PMR Ready] INNER JOIN [PjM Presentation Order] ON [eQuad - PMR Ready].PjM = [PjM Presentation Order].PjM
WHERE ((([eQuad - PMR Ready].[PMR Ready?])=Yes) And (([eQuad - PMR Ready].[TO Status])="Current TO") And (([eQuad - PMR Ready].[Is this to be briefed at next PMR?])=Yes) And (([eQuad - PMR Ready].eQuad.[Mark for Archive])=No) And (([eQuad - PMR Ready].Hold)=No)) Or ((([eQuad - PMR Ready].[TO Status])="Current TO") And (([eQuad - PMR Ready].[Is this to be briefed at next PMR?])=Forms![Report Selection]![PMR only check]))
ORDER BY [PjM Presentation Order].[Presentation Order], [eQuad - PMR Ready].[Slide Order], [eQuad - PMR Ready].[Task Order #];

Kstruth is offline   Reply With Quote
Old 11-15-2019, 11:50 AM   #8
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 6,445
Thanks: 58
Thanked 1,412 Times in 1,393 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Program Macro to Return Results Based on Checkbox

Hi. I don't see anywhere in your SQL where you were trying to limit the result to those ready for a meeting. Or, is that the question, how to add it?
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Old 11-15-2019, 12:13 PM   #9
Kstruth
Newly Registered User
 
Join Date: Oct 2019
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Kstruth is on a distinguished road
Re: Program Macro to Return Results Based on Checkbox

Yes, please tell me how to do that because it worked long before coming on board - but I have never seen it work since I've been here.
Kstruth is offline   Reply With Quote
Old 11-15-2019, 12:25 PM   #10
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 6,445
Thanks: 58
Thanked 1,412 Times in 1,393 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Program Macro to Return Results Based on Checkbox

Quote:
Originally Posted by Kstruth View Post
Yes, please tell me how to do that because it worked long before coming on board - but I have never seen it work since I've been here.
Well, first, you could try to experiment by removing all the criteria first. When you run the query, you should see all the records. Then, you could add each criteria one at a time to make sure it keeps working. For example, you could start with (assuming the "ready for meeting" field is a yes/no field):


...WHERE [Ready for meeting]=True

__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Reply

Tags
forms , macro , macro button , reports , sharepoint author

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Parameter Query returning Incorrect Results based on checkbox mbamber Queries 2 07-31-2013 11:34 AM
Dsum criteria to return current month results based on date in another field Ray Spackman Forms 20 09-28-2011 12:01 AM
Macro for Copying cells based on Checkbox vid Excel 10 04-25-2010 04:46 PM
return weekend results on Monday, yesterday's results otherwise brucle Queries 5 11-14-2007 08:26 AM
Query to return scored or weighted results based on user entered criteria Jasontm01 Queries 1 03-08-2004 12:07 PM




All times are GMT -8. The time now is 08:26 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World