Ok if I am understanding properly, you have the form Travel Reqest 0 open and
then you open th Final TA number form from a button on Travel Reqest 0. Then
in the on click event on the button on the Final TA numberform you want to
copy a value from the subform. This is fairly easy, all you have to do is
Forms![Travel Request 0 Layover]![Travel Request.TA ] = Me.[TA
Numbers].Form![TA Number]
This line of code copys the value from the subform to the other. You do not
need to worry about setting focus and other steps. One change is if the
button to copy is on the subform and not the main the code woud be
Forms![Travel Request 0 Layover]![Travel Request.TA ] = Me.[TA Number]
Then put the docmd.close to close the form.
Chey said:
I am still confussed.
Okay here is what is fully going on. I open the form Travel Reqest 0
Layovers. I have a command button that opens another form Called Final TA
Number with a subform called TA Number. On that form I then have another
command button. Here I want it to do the following.
Set focus to the TA Number Field
Copy the field
Close the form
-So now it is back to the original form
Set focus on Travel Request.TA Number
and paste.
This is the full process that I would like to do.
I tried to do it in macors but got hung up on the gotocontrol part. I don't
know if it was becasue of the sub form or not.
Any ways thanks for all the help. I am a little slow when it comes to so
much coding.
Thanks again
:
My bad, I did not read the full question before answering. I got ahead of
myself.
DoCmd.OpenForm "Travel Request 0 Layover"
' I am assuming that the form opens to where you want to copy to or else you
will need to filter or goto the correct record
Forms![Travel Request 0 Layover]![Travel Request.TA ] = Me.[TA
Numbers].Form![TA Number]
Docmd.close
or you could define a variable
Dim TANo as variant 'made it variant because i am unsure of your data type
TANo = Me.[TA Numbers].Form![TA Number]
docmd.close
DoCmd.OpenForm "Travel Request 0 Layover"
Forms![Travel Request 0 Layover]![Travel Request.TA] = TANo
:
Not fully sure if Travel reuest 0 Layover is a new for or sub, so you will
have to modiy to make it work
Me.[Travel Request 0 Layover].Form![Travel Request.TA ] = Me.[TA
Numbers].Form![TA Number]
:
I have a cody going.
This is what I have so far
Me.[TA Numbers].Form![TA Number].SetFocus
DoCmd.CopyObject it goes good until here. How do I get it to copy and then
paste under Travel Request 0 Layover then field name Travel Request.TA Number?
DoCmd.Close
DoCmd.OpenForm "Travel Request 0 Layover"