OpenForm macro with 2 criteria

  • Thread starter jrthor_85 via AccessMonster.com
  • Start date
J

jrthor_85 via AccessMonster.com

Greetings,

I have a form [PartLookup] which is basically a master list of all [PartNo]
with corresponding [InquiryNo] and customer. There are multiple part numbers
per inquiry, and the same partno may exist in multiple inquiries. I have
another form [NewInquiry] (inquiry overview) with a subform
[NewInquirySubform] (parts within inquiry).

I am trying to create an OpenForm macro that on doubleclicking [PartNo] in
the [PartsList1] form, will open both the specified [PartNo] in the frm
[NewInquirySubform], but also the corresponding [InquiryNo] in the parent frm
[NewInquiry].

I have tried

[Forms]![NewInquirySubform]![PartNo]=[Forms]![PartLookup]![PartNo]

with the OpenForm set to the parent form ( [NewInquiry] ), and many
variations on that, but every time I try to run the macro, it prompts me to
enter the [PartNo]. Even if I just target OpenForm to frm[NewInquiry], which
does not have at PartNo field, and run the macro

[PartNo]=[Forms]![PartLookup]![PartNo]

which shouldn't work, it would pop up the dialog and, if entered, would
open the form. I have also tried something like

[InquiryNo] = Forms![PartLookup]![InquiryNo] And Forms![NewInquiry]!
[NewInquirySubform]![PartNo] = Forms![PartLookup]![PartNo]

It seems no matter how I do it, it always pops up the dialog.
Any suggestions would be greatly appreciated.
John T.
 
J

jrthor_85 via AccessMonster.com

Figure I'd give this a bump, as I've still been brainstorming this with
little success.

Any help would still be greatly appreciated.
John
 
S

Steve Schapel

John,

What you are asking for here is not possible. Well, not in the way you are
going about it.

The Where Condition argument of the OpenForm action only applies to the form
you are opening.

One way around it would be to make a Query, that refers to
[Forms]![PartLookup]![PartNo] in the criteria, and then set this query as
the Record Source property of the subform.

A similar result would be obtained by using a SetValue action, or
SetProperty action, in your macro, to adjust the Record Source property of
the subform.

As another alternative, you might also consider a GoToControl action (to set
the focus to the subform), followed by an ApplyFilter action. I have never
tried this, but I think it may work ok.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top