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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditions on one form affect another form 2

Status
Not open for further replies.

netrusher

Technical User
Feb 13, 2005
952
US
Below is the code I have on Form open. What I am trying to accomplish is:

If the [Engineering Distribution] Field on subform ECNDetailfrm has a name in it,
I want the AssyExcessOneThree Field on Form CancelledPartsQryForm
to say YES] If the [Engineering Distribution is Blank I want the
AssyExcessOneThree Field to be blank.

When I used the code below I am getting a
Run-time Error 2448 you can't assign a value
to this object
when I try and open the form.

Maybe the code is at the wrong place. By the way the CancelledPartsQryForm is
a continuous form.

Any suggestions on how to accomplish what I am trying to do?

Code:
Private Sub Form_Open(Cancel As Integer)

If Forms!ECNBCNVIPfrm!ECNDetailfrm![Engineering Distribution] > Blank Then
Me.AssyExcessOneThree.Value = "yes"
Else
Me.AssyExcessOneThree.Value = ""
End If

End Sub
 
Howdy netrusher . . .

I sure your aware both forms have to be open! Try the following:
Code:
[blue]If Trim(Forms!ECNBCNVIPfrm!ECNDetailfrm[purple][b].form[/b][/purple]![Engineering Distribution] & "") <> "" Then
   Me.AssyExcessOneThree = "yes"
Else
   Me.AssyExcessOneThree = ""
End If[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Hey Aceman

I am testing this code. I want the Ctl1-3TEng field to
say no if the Engineering Distribution field is blank
but everything says Yes even if it is Blank. Can you
see what is wrong?

Code:
If Trim([Engineering Distribution] & "") <> "" Then
   Me.Ctl1-3TEng = "Yes"
Else
   Me.Ctl1-3TEng = "No"
End If
 
netrusher . . .

In prior code [blue][Engineering Distribution][/blue] was referenced via subform. Are you saying [blue]Me.Ctl1-3TEng[/blue] is on the same subform?

Where is the code running (what form/subform, what event)?

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Aceman,

The [Engeering Distribution] field is on the subform and
also part of the query that makes up the CancelledPartsQryForm. I have tried the code both ways.
Should I stick with the subform location?

Also, with the CancelledPartsQryForm being a continuous
form is this causing any issues?
 
I'd use the Load event instead of the Open event.
Furthermore, you can't assign a value to a control which ControlSource property is set to a formula.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top