So frustrated... why wont' this copy?

C

Crispy

Hi all,

All I want to do is copy a textbox value into one form from another
form. Both forms are open when this occurs.

Here is my code:

Private Sub Form_Close()

If IsNull(Forms!frmNewStudent!ParentID) Then
Forms!frmNewStudent!ParentID = Forms!frmNewParent!ParentsID
Else
End If

End Sub

frmNewParent is the form being closed and copied from
frmNewStudent is the form remaining open and being copied to


This code worked fine used inbetween two other forms...but suddenly,
inbetween these two forms, is only copying the first digit of the value
in the text box over.

Help? Ideas?

Thanks for any help.
 
C

Crispy

On what event would I use it on then? It worked on the other form's On
Close event?

Thanks for help
 
L

Lynn Trapp

Actually, there should have been a question mark at the end of my sentence,
as that's how it was intended. I was merely wondering if that might be the
cause. You might try the Unload event, which fires first as a form is
closing.
 
C

Crispy

Well your advise helped. When I moved the code to the AfterUpdate
event... it worked. However, I still find it strange that it wouldn't
work on the OnClose event--- when the same piece of code worked for
another two forms on the OnClose event...
but...

Oh well. Happy I got it working.

Thank you!
 
D

david epsom dot com dot au

You loose the pointer to the recordset before you loose the
recordset: it is probably copying the value from the 'first'
record in the recordset, rather than the value from the
record you thought you were using.

(david)
 
L

Lynn Trapp

What David said AND there may have been some delay in actually destroying
the value held in the pointer to the control on the closing form, so that
you were just being lucky. It may not have actually been working, but looked
like it was.
 
Top