INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

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

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

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

(OP)
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?

RE: Docmd.openform - Unbound Mainform criteria applies to subform--

(OP)
Exactly.

RE: Docmd.openform - Unbound Mainform criteria applies to subform--

Lameid,
Any chance you could share a small demo of this?

Duane
Hook'D on Access
MS Access MVP

RE: Docmd.openform - Unbound Mainform criteria applies to subform--

(OP)
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.

RE: Docmd.openform - Unbound Mainform criteria applies to subform--

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

RE: Docmd.openform - Unbound Mainform criteria applies to subform--

lameid, I have never ever made a mistake like that blush

Duane
Hook'D on Access
MS Access MVP

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close