change data on first form

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
 
T

tina

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
 
G

Guest

HI again

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

Thanks
Phil
 
T

tina

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

End Sub
 

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

Top