change data on first form

  • Thread starter Thread starter Phil
  • Start date Start date
P

Phil

Hi,

I have a form with a command button which open a second
form. If a certain field is changed on the second form
and another field has a given value, I want to change a
field on the first form. I know that I need an "IIF"
statement, but no matter what I try I get the message that
it does not know the field name on the first form.

Any help?

Thanks,
Phil
 
Private Sub ControlName_AfterUpdate()

With Me
If .ControlName = "something" Then
Forms!FirstFormName!ControlName = "something"
End If
End With

End Sub

the above assumes that
1) the first form is still open.
2) the value in ControlName is text data type, not numeric.
3) you want to run the code when you update the value in ControlName,
*regardless of what you update it to*.
4) the value in Forms!FirstFormName!ControlName is text data type, not
numeric.

if you need something more specific, pls post more detail including the code
you already tried that didn't work.

hth
 
HI again

Thanks for your response. The data type id DATE. What
would that change?

Thanks
Phil
 
With Me
If .ControlName = #somedate# Then
Forms!FirstFormName!ControlName = #somedate#
End If
End With

End Sub
 
Back
Top