command button to copy parent data to subform field

B

Brian

I have a command button on my parent (continuous) form that when clicked
copies the data from a field to a field on my subform. The parent form is a
continuous form and the subform displays some detailed data for the record
with focus. When I click on the command button I take the data from a field
on the parent form and copy it to a subform field. All works fine as long as
the record has focus before the button is clicked. Here is my code for doing
so:

Private Sub Command47_Click()
Parent![frm_Project_Update_Detail 800]![Budget_Date] = Me.[Due Date]
End Sub


The problem I am having is if I click the button on a record in the parent
form that does NOT have focus yet, it writes the data from that new record
(that just got the focus) to the field in the subform prior to the subform
updating to that record which now has the focus. The end result is that the
data gets written to the wrong record in the subform. Basically the subform
doesn't have time to update to the new record before the data gets written.
Does anyone know how I can fix this?

Thanks in Advance!
Brian
 

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