UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Report Filter Not Working, Access 2016    
 
   
tbayless
post Aug 23 2017, 11:11 AM
Post#1



Posts: 3
Joined: 23-August 17



Hello!

Extremely new to Access so please forgive me "newbie" question. I am building a simple database for reordering parts and and trying to open a filtered report that we can email. I have used the button builder to create the mail but when i create the below code to filter nothing happens or everything gets dropped into the report. I want to filter the part i have currently on my form when i click this button. I'm sure I am just missing a simple piece of code, but again very new smile.gif. Thank you in advance!

DoCmd.OpenReport "Accessory", acViewPreview, "ID = " & Me.ID
Go to the top of the page
 
theDBguy
post Aug 23 2017, 11:28 AM
Post#2


Access Wiki and Forums Moderator
Posts: 71,233
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Welcome to UtterAccess!
welcome2UA.gif

Is ID a Text or a Number field? Where do you have this code located?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
tbayless
post Aug 23 2017, 11:32 AM
Post#3



Posts: 3
Joined: 23-August 17



ID is set as an autonumber, the code for this is stored on a form, I have a macro created that lets me select which ID i want, but i want it to autofill the report based on the ID i have pulled up on the form. I hope I am making sense...
Go to the top of the page
 
theDBguy
post Aug 23 2017, 11:37 AM
Post#4


Access Wiki and Forums Moderator
Posts: 71,233
Joined: 19-June 07
From: SunnySandyEggo


Here's an obvious question... The report's Record Source includes the matching ID field, correct? If so, are you saying the form opens but shows all records rather than just one for the matching ID? If so, the code is syntactically correct. You'll have to examine the value of Me.ID to make sure it is what you are expecting it to be.

Hope it helps...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
tbayless
post Aug 23 2017, 12:19 PM
Post#5



Posts: 3
Joined: 23-August 17



That is correct everything is matching. I did find the fix for it...again really simple as i expected, i moved the filter over to the "where" condition and it took right off. Thank you for the help!
Go to the top of the page
 
theDBguy
post Aug 23 2017, 12:26 PM
Post#6


Access Wiki and Forums Moderator
Posts: 71,233
Joined: 19-June 07
From: SunnySandyEggo


Ah, good catch. I didn't notice the missing comma. Good luck with your project.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    17th December 2017 - 05:03 AM