Connecting Tech Pros Worldwide Forums | Help | Site Map

Opening a form from a subform based on 3 crtiteria

birt
Guest
 
Posts: n/a
#1: Sep 20 '07
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


Ben
Guest
 
Posts: n/a
#2: Sep 20 '07

re: Opening a form from a subform based on 3 crtiteria


On Sep 20, 10:37 am, birt <birtwistl...@sierramgt.comwrote:
Quote:
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.

birt
Guest
 
Posts: n/a
#3: Sep 20 '07

re: Opening a form from a subform based on 3 crtiteria


On Sep 20, 1:51 pm, Ben <bmarl...@gmail.comwrote:
Quote:
On Sep 20, 10:37 am, birt <birtwistl...@sierramgt.comwrote:
>
Quote:
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:
>
Quote:
Private Sub Form_DblClick(Cancel As Variant)
>
Quote:
DoCmd.OpenForm "CostElementsFrm", , , "[sol_no] = " & Me![Sol_No]
And [SubSortKey] = Me![SubSortKey] And [CostContractor] = Me!
[CostContractor]
>
Quote:
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.

Ben
Guest
 
Posts: n/a
#4: Sep 21 '07

re: Opening a form from a subform based on 3 crtiteria


On Sep 20, 1:12 pm, birt <birtwistl...@sierramgt.comwrote:
Quote:
On Sep 20, 1:51 pm, Ben <bmarl...@gmail.comwrote:
>
>
>
Quote:
On Sep 20, 10:37 am, birt <birtwistl...@sierramgt.comwrote:
>
Quote:
Quote:
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:
>
Quote:
Quote:
Private Sub Form_DblClick(Cancel As Variant)
>
Quote:
Quote:
DoCmd.OpenForm "CostElementsFrm", , , "[sol_no] = " & Me![Sol_No]
And [SubSortKey] = Me![SubSortKey] And [CostContractor] = Me!
[CostContractor]
>
Quote:
Quote:
End Sub
>
Quote:
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!

Closed Thread