Copy text to subform

G

Gabe

Hello,

I am new at this, I was wondering if there is a way to copy a few text
fields from a main form and paste them into a subform with the click of a
command button?

The subform is a continuous "History" table so that we can see any changes
that have been made to a main record. If the user wants to make changes to a
main record, they'll push the command button to create a history, and then
make their changes on the main form. I thought an append query would work but
I don't want to create a history for records that have not changed. I am
using Access 2003. I'm not too familiar with VBA either. The fields on the
main form (Master) are (EmpName, EmpID, Agency, etc...) and they match the
subform (History) fields. Any help would be greatly appreciated.

Thanks,
~Gabe
 
A

Arvin Meyer [MVP]

Put a button, or use the subform's double-click event and use code like:

Private Sub Form_DblClick(Cancel As Integer)
Me.ControlName1 = Me.Parent.ControlName1
Me.ControlName2 = Me.Parent.ControlName2
Me.ControlName3 = Me.Parent.ControlName3
' etc
End Sub

Where ControlName = the name of the textbox you are dealing with.
 
G

Gabe

Awesome! Thank you that worked great.

~Gabe

Arvin Meyer said:
Put a button, or use the subform's double-click event and use code like:

Private Sub Form_DblClick(Cancel As Integer)
Me.ControlName1 = Me.Parent.ControlName1
Me.ControlName2 = Me.Parent.ControlName2
Me.ControlName3 = Me.Parent.ControlName3
' etc
End Sub

Where ControlName = the name of the textbox you are dealing with.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 

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