By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,488 Members | 2,545 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,488 IT Pros & Developers. It's quick & easy.

Opening a form from a subform based on 3 crtiteria

P: n/a
I have a form with two subforms on it. On my 2nd subform I want to
open a new form base on three criteria. One is a string two are
integer. It has been over six years since I have done this and I have
tried many ways but nothing is working. Any help will be greatly
appreciated. Don't laugh too hard but my last try is as follows:
Private Sub Form_DblClick(Cancel As Variant)

DoCmd.OpenForm "CostElementsFrm", , , "[sol_no] = " & Me![Sol_No]
And [SubSortKey] = Me![SubSortKey] And [CostContractor] = Me!
[CostContractor]
End Sub

Sep 20 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Ben
On Sep 20, 10:37 am, birt <birtwistl...@sierramgt.comwrote:
I have a form with two subforms on it. On my 2nd subform I want to
open a new form base on three criteria. One is a string two are
integer. It has been over six years since I have done this and I have
tried many ways but nothing is working. Any help will be greatly
appreciated. Don't laugh too hard but my last try is as follows:

Private Sub Form_DblClick(Cancel As Variant)

DoCmd.OpenForm "CostElementsFrm", , , "[sol_no] = " & Me![Sol_No]
And [SubSortKey] = Me![SubSortKey] And [CostContractor] = Me!
[CostContractor]

End Sub
I'm confused, what is "Me!" referring to? Is it the form, the
subforms, or the form you are opening?
If you are setting values in the form you are opening it should either
be tied directly to the first form, or set with an on open event.

Sep 20 '07 #2

P: n/a
On Sep 20, 1:51 pm, Ben <bmarl...@gmail.comwrote:
On Sep 20, 10:37 am, birt <birtwistl...@sierramgt.comwrote:
I have a form with two subforms on it. On my 2nd subform I want to
open a new form base on three criteria. One is a string two are
integer. It has been over six years since I have done this and I have
tried many ways but nothing is working. Any help will be greatly
appreciated. Don't laugh too hard but my last try is as follows:
Private Sub Form_DblClick(Cancel As Variant)
DoCmd.OpenForm "CostElementsFrm", , , "[sol_no] = " & Me![Sol_No]
And [SubSortKey] = Me![SubSortKey] And [CostContractor] = Me!
[CostContractor]
End Sub

I'm confused, what is "Me!" referring to? Is it the form, the
subforms, or the form you are opening?
If you are setting values in the form you are opening it should either
be tied directly to the first form, or set with an on open event.
I will try to be clearer.

Me is referring to the subform and I am not setting values. I want to
open a form (CostElementFrm) from subform2 where the field (sol_no,
subsortkey, and costcontractor) values on the CostElement form equal
the values of the subform.

The Main Form links to Subfrm1 through the field sol_no.
Subfrm1 links to Subfrm2 through the fields Sol_No and
CostContractor.
SubFrm2 need to open form (CostElementFrm) where the value from fields
Sol_No, CostContractor and SubSortKey equal the same field values on
Subfrm2.

Hope this helps. Thank you.

Sep 20 '07 #3

P: n/a
Ben
On Sep 20, 1:12 pm, birt <birtwistl...@sierramgt.comwrote:
On Sep 20, 1:51 pm, Ben <bmarl...@gmail.comwrote:
On Sep 20, 10:37 am, birt <birtwistl...@sierramgt.comwrote:
I have a form with two subforms on it. On my 2nd subform I want to
open a new form base on three criteria. One is a string two are
integer. It has been over six years since I have done this and I have
tried many ways but nothing is working. Any help will be greatly
appreciated. Don't laugh too hard but my last try is as follows:
Private Sub Form_DblClick(Cancel As Variant)
DoCmd.OpenForm "CostElementsFrm", , , "[sol_no] = " & Me![Sol_No]
And [SubSortKey] = Me![SubSortKey] And [CostContractor] = Me!
[CostContractor]
End Sub
I'm confused, what is "Me!" referring to? Is it the form, the
subforms, or the form you are opening?
If you are setting values in the form you are opening it should either
be tied directly to the first form, or set with an on open event.

I will try to be clearer.

Me is referring to the subform and I am not setting values. I want to
open a form (CostElementFrm) from subform2 where the field (sol_no,
subsortkey, and costcontractor) values on the CostElement form equal
the values of the subform.

The Main Form links to Subfrm1 through the field sol_no.
Subfrm1 links to Subfrm2 through the fields Sol_No and
CostContractor.
SubFrm2 need to open form (CostElementFrm) where the value from fields
Sol_No, CostContractor and SubSortKey equal the same field values on
Subfrm2.

Hope this helps. Thank you.
Have you tried referring to the form directly? It may not be using the
right "me". So try SubFrm2! instead of me!

Sep 21 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.