Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Docmd.openform - Unbound Mainform criteria applies to subform-- 2

Status
Not open for further replies.

lameid

Programmer
Jan 31, 2001
4,207
0
0
US
I thought this odd and thought I'd share.
I ran across the below line of code and in and of itself nothing is too peculiar to me on first glance.

But consider that "frm_z" is unbound. Then consider there is a subform on it that is a continuous form in datasheet view. The criteria is being applied to the subform and works. It seems to me that the criteria should be applied to the main form.

Code:
DoCmd.OpenForm "frm_z", acNormal, , "[codelist]=Forms![frm_x]![txt_Code]", acFormEdit, acDialog

On the one hand this is really cool that you can do it. On the other... What? Anyone have any thoughts as to why or whether it will stay the same in later versions?
 
Well this is embarrassing, I really thought I had looked at the subform recordsource. The subform actually has criteria in it similar to the filter criteria parameter and I missed it. Thanks for asking for a Demo Duane, it forced me to actually see it.

My faith is restored in Access functional integrity and my expectations in seeing questionable code are increased.
 
So the open args criteria isn't doing anything, the subform had hardcoded filtering applied.

I hate those types of errors, it has you chasing ghosts and questioning your own sanity!

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top