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 Filtering Returns First Record Every Time, Access 2016    
 
   
dday76
post Nov 3 2017, 11:17 PM
Post#1



Posts: 161
Joined: 3-July 06
From: New York, NY


(I posted a similar question earlier, but this is an issue with a different setup.)
I have a Report I'm trying to 1) Print and 2) Email.
The buttons are in a Form.
The form has a field called "ID." The Report has a field called "ProjectID." ID is in a table. ProjectID is in a query and simply renames ID with no other processing. So if one exists, the other will always exist and be equivalent.

The buttons run a macro with the following: Where Condition = ="[ProjectID]=" & [ID]
This is the same in Embedded Macros for both the Print and Email buttons. See image attached.

The functionality I get is it just shows the first record every time.
The functionality I want is for it to show the current record in the form.
So if the Form is showing ID=3, then the Report should show ProjectID=3. But it currently shows ProjectID=1 regardless what ID is on the Form when the button is pushed.

I appreciate your help. I've tried this a bunch of different ways and it just isn't working.
Attached File(s)
Attached File  buttons.png ( 214.8K )Number of downloads: 2
 

--------------------
The smart man learns from his mistakes, but the wise man learns from the mistakes of others.
The sock monster got your code
Go to the top of the page
 
RJD
post Nov 3 2017, 11:42 PM
Post#2


UtterAccess VIP
Posts: 7,852
Joined: 25-October 10
From: Gulf South USA


Hi: Given that the form is open and the active record on the form is what you want, perhaps you should refer to the form control rather than just the ID field alone. Something like this ...

Where Condition = ="[ProjectID]=" & Forms!MyFormName![ID]

(Substituting your form name and control name - not field name - if different.)

I don't use macros, preferring to use VBA procedures, so maybe I am off a bit on this. But it might be worth a try.

Failing this, perhaps you could post a cut-down db with relevant objects and no sensitive data (examples only) and someone could take a look and test this approach - or see a way to do something differently.

HTH
Joe

--------------------
"Each problem that I solved became a rule, which served afterwards to solve other problems."
"You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing."

Rene Descartes 1596-1650 (Mathematician and Philosopher)
Go to the top of the page
 
GroverParkGeorge
post Nov 4 2017, 09:20 AM
Post#3


UA Admin
Posts: 31,256
Joined: 20-June 02
From: Newcastle, WA


I agree with Joe (on all counts).

The problem is that the macro is probably not referring to the currently selected ID that you want to use to open or print the report.

--------------------
Go to the top of the page
 
dday76
post Nov 4 2017, 02:03 PM
Post#4



Posts: 161
Joined: 3-July 06
From: New York, NY


Thanks all. I had a close object function misplaced that was closing the form so it couldn't see ID. I was able to move that and fix the issue. Thanks!

--------------------
The smart man learns from his mistakes, but the wise man learns from the mistakes of others.
The sock monster got your code
Go to the top of the page
 
RJD
post Nov 4 2017, 02:16 PM
Post#5


UtterAccess VIP
Posts: 7,852
Joined: 25-October 10
From: Gulf South USA


Good to hear you got that resolved. Good luck with your project.

Regards,
Joe

--------------------
"Each problem that I solved became a rule, which served afterwards to solve other problems."
"You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing."

Rene Descartes 1596-1650 (Mathematician and Philosopher)
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    18th December 2017 - 11:44 AM