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
> Openform Where Condition Applies Filter To Opened Form?, Access 2016    
 
   
technopathetic
post Nov 14 2019, 04:32 PM
Post#1



Posts: 8
Joined: 31-July 17



Hi all, I'm a bit confused about what I'm seeing here.

I have a database with two primary sections: Work Orders (one) and Discrepancies (many). On the Work Order form, there is a button to open the Discrepancy form and show all records for that Work Order.

I have the "Discrepancy" form, and the where condition is being applied from the button:
CODE
DoCmd.OpenForm "frmDiscrepancies", , , "[WorkOrder_FK] = " & Forms!frmWorkOrders![WorkOrder_PK]


However, this is applying a filter to "frmDiscrepancies" instead of behaving like a Where condition like I expected. My users need to be able to filter just the records associated with the Work Order they chose. Originally I had put the Where condition in the form's query, but I'd like to be able to use the same form to "View All Discrepancies" with a different button.
Am I using the wrong syntax, or does DoCmd.OpenForm not function that way?

Thanks for any help smile.gif
Go to the top of the page
 
theDBguy
post Nov 14 2019, 04:44 PM
Post#2


UA Moderator
Posts: 76,910
Joined: 19-June 07
From: SunnySandyEggo


Hi. Welcome to UtterAccess! welcome2UA.gif

Maybe it's just a bad naming choice for the argument, but the behavior you're observing is normal. So, if you really want to limit the form to only contain certain records, you will have to modify its RecordSource instead.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
technopathetic
post Nov 14 2019, 04:57 PM
Post#3



Posts: 8
Joined: 31-July 17



Well, it's good to know at least that it's not just me! Thanks a ton. The language in most of the articles/forums I was reading seemed like it contradicted itself. smile.gif
Go to the top of the page
 
theDBguy
post Nov 14 2019, 05:01 PM
Post#4


UA Moderator
Posts: 76,910
Joined: 19-June 07
From: SunnySandyEggo


Right. Although the argument is called "WhereCondition," it's just applied to the form's Filter property.

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


Custom Search


RSSSearch   Top   Lo-Fi    15th December 2019 - 04:08 PM